#K50177. Most Frequent Integer
Most Frequent Integer
Most Frequent Integer
Given a list of n integers, find the integer that appears most frequently. If there are multiple integers with the same frequency, return the smallest integer among them. Formally, define the frequency of an integer \(i\) as \(f(i)\). You need to output \(\min\{ i \mid f(i)=\max_{j}f(j) \}\).
inputFormat
The input is read from standard input (stdin). The first line contains a single integer n indicating the number of integers. The second line contains n space-separated integers.
outputFormat
Output to standard output (stdout) a single integer, which is the integer that appears most frequently. In the case of a tie, output the smallest one.
## sample1
1
1