1. 

/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #10107 (What is the Median?)
* http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=13&page=show_problem&problem=1048
*
* @author Christian Posselt
* @author Jonathan Schubert
* @version 1.0, 05/07/2009
*
* Status : Accepted
* Runtime: 2.068
*/

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

public static void main(String[] args)
{
//set up variables needed
Scanner sc = new Scanner(System.in);
ArrayList<Integer> list = new ArrayList<Integer>();
StringBuilder answer = new StringBuilder();
int bottom, top, median;

while(sc.hasNext())
{
//add next integer and sort
list.add(sc.nextInt());
Collections.sort(list);

//Median depends whether size of List is even or odd
if(list.size()%2!=0)
{
answer.append(list.get(list.size()/2));
answer.append("\n");
}
else
{
top = list.get((int)(list.size()/2));
bottom = list.get(((int)(list.size()/2))-1);
median = (top+bottom)/2;

answer.append(median);
answer.append("\n");
}
}
System.out.print(answer.toString());
}
}