What is the Median?#1304

What is the Median?

1 second
128 megabytes
Medium

Median plays an important role in statistics. By definition, the median is a value that divides a set into two equal parts. In this problem, you are required to determine the median of a given set of integers.

For example, consider the sequence \{1, 3, 6, 2, 7\}. Here, is the median, because there are exactly two numbers on each side of it: and .

If the sequence contains an even number of elements, such as \{1, 3, 6, 2, 7, 8\}, no single number can divide the array into two equal parts. In this case, we take the arithmetic mean of the two middle numbers: . Thus, the median will be (3 + 6)/2 = 4.5. However, in this problem, you must print only the integer part of the median, ignoring its fractional part. So, for this example, the answer is .

Input

The input is a sequence of integers (0 \le x < 2^{31}), with no more than numbers.

Output

For each input integer, output on a separate line the current median of the sequence. For each median value, only print its integer part.

Examples

Example 1

Loading
Loading