#C11202. Most Frequent Element
Most Frequent Element
Most Frequent Element
Given an array of integers, your task is to find the most frequent element. In case multiple elements appear with the same maximum frequency, return the smallest element among them.
More formally, let \(A = [a_1, a_2, \ldots, a_n]\) be the input array. Define the frequency \(f(x)\) of an element \(x\) as the number of times it appears in \(A\). You need to choose an element \(x\) such that \(f(x)\) is maximized. If there exists more than one element with maximum frequency, output the one with the smallest numerical value.
inputFormat
The input is provided via standard input (stdin). The first line contains a single integer \(n\) representing the number of elements in the array. The second line contains \(n\) space-separated integers.
outputFormat
Output the most frequent element according to the given condition using standard output (stdout).
## sample1
1
1
</p>