0168. The Middlest Number

Имя входного файла: midnum.in
Имя выходного файла: midnum.out
Ограничение по времени: 1 s
Ограничение по памяти: 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


Источник: Petrozavodsk Summer 2003. KOTEHOK's Contest, Sunday, August 31
Автор: Andrew Lopatin

Обсудить       Отправить решение



Версия для печати