0168. The Middlest Number

Input file name: midnum.in
Output file name: midnum.out
Time limit: 1 s
Memory limit: 64 megabytes

One can perform the following operations to get the middlest number of a given sequence a1, a2, …, an written on the blackboard. He must select the minimal number amin, the maximal number amax, erase them and write down (amin+amax)/2. After repeating this n-1 times, there will be only one number on the blackboard. We will call it the middlest number.

Your task is to find the middlest number of a given sequence of integers.

Input file

The first line contains integer 1 ≤ n ≤ 239017. The next n lines contain numbers ai.

Output file

Output the middlest number of the given sequence with six digits after the decimal point.

Examples:

midnum.inmidnum.out
3 2 3 94.250000


Source: Petrozavodsk Summer 2003. KOTEHOK's Contest, Sunday, August 31
Author: Andrew Lopatin

Discuss       Submit a solution



Printable version