Windy weather 4#5728

Windy weather 4

1 second
16 megabytes
Medium

Piglet, while lying in the meadow, watched the blades of grass sway in the wind. He realized that the swaying was due to the wind and devised a method to measure the wind's strength using the grass blades. According to Piglet, the wind strength is defined as the height of the largest group of grass blades that share the same height. If there are multiple such groups, the wind strength is the height closest to the average of all distinct heights. If there is still a tie, the smallest height among them is chosen, as Piglet preferred calm weather.

Input

The first line contains a single integer , representing the number of grass blades Piglet is observing. The second line contains integers, separated by spaces, indicating the heights of the grass blades.

All input values are natural numbers not exceeding , since Piglet did not like counting much and had never encountered numbers greater than in his life.

Output

Output a single number, which is the wind strength according to Piglet's definition.

Examples

Example 1

Loading
Loading

Example 11

Loading
Loading