Largest average

Given N grades, repeatedly replace any two numbers with their average until one remains; find the largest possible final value.

Medium5GreedyMathSortingImplementationInterviewNo attempts yetTime limit1sMemory limit64 MB

Problem

Little Ivica received NN math grades and wants to compute their average. He knows that the average of two numbers aa and bb is (a+b)/2(a+b)/2, but he does not yet know what to do with more than two numbers. So he writes the NN grades down and repeats the following procedure N1N-1 times.

  1. He picks two of the written numbers and erases them.
  2. He writes down the average of the two numbers he picked.

After N1N-1 steps a single number is left, and Ivica takes it for his average grade. Find the largest number that can be left this way.

Input

The first line contains the integer NN (1N201 \le N \le 20).

The ii-th of the next NN lines contains the integer XiX_i (1Xi51 \le X_i \le 5), the ii-th grade.

Output

Print the largest number that can be left, rounded to six digits after the decimal point, on one line. Print all six digits, including trailing zeros. If the exact value lies exactly halfway between two six-digit decimals, round up.

Note

Take the grades 1, 3 and 5. At the start, 1, 3 and 5 are written down. In the first step Ivica picks 1 and 3, erases them and writes 2, so 2 and 5 remain. In the second step he writes the average of the two remaining numbers, which is 3.5.

If NN is 1, the procedure runs zero times, so the single grade is the answer.