Numbers
Time limit1sMemory limit128 MB
Given N positive integers, find the value with the highest frequency, breaking ties by choosing the smallest value.
Problem
You are given positive integers . Write a program that finds the smallest value that appears at least as many times as every other number in the sequence (that is, a value whose frequency is maximal).
In other words, among all values that share the maximum frequency, output the smallest one.
Input
The first line contains a single integer . Each of the next lines contains one integer (for ).
Output
Print a single integer: the smallest value that appears at least as many times as any other number. Equivalently, if several values share the maximum frequency, print the smallest of them.