Statistics

Time limit2sMemory limit256 MB

Problem

Processing integers is an important task in statistics. Given an odd number $N$ of integers, compute the following four basic statistics.

  1. Arithmetic mean: the sum of the $N$ numbers divided by $N$, rounded to the nearest integer
  2. Median: the middle value after sorting the $N$ numbers in nondecreasing order
  3. Mode: the value that appears most often. If there is more than one, use the second smallest such value
  4. Range: the difference between the maximum and minimum values

Write a program that prints these four values for the given numbers, in order.

Input

The first line contains the number of values $N$. $(1 \le N \le 500,000)$

$N$ is odd. Each of the next $N$ lines contains one integer. The absolute value of every integer is at most $4,000$.

Output

On the first line, print the arithmetic mean, rounded to the nearest integer.

On the second line, print the median.

On the third line, print the mode. If there are multiple modes, print the second smallest one.

On the fourth line, print the range.