#K71347. Most Frequent Integer
Most Frequent Integer
Most Frequent Integer
You are given an array of n integers. Your task is to find the integer that appears most frequently in the array. In case there are multiple integers with the same maximum frequency, output the smallest one among them.
Note: The input will be provided via standard input (stdin) and the output must be written to standard output (stdout).
Example:
Input: 9 1 2 2 3 3 3 4 4 4</p>Output: 3
inputFormat
The first line contains an integer n — the number of elements in the array. The second line contains n space-separated integers which represent the elements of the array.
outputFormat
Output a single integer — the most frequent integer in the array. If there is a tie, output the smallest integer among those with the maximum frequency.
## sample9
1 2 2 3 3 3 4 4 4
3