CPython lite logoProblemsContests

41. Mode of Numbers #2

 n numbers are given. Find the mode of these numbers. The mode is defined as the number that appears most frequently. If there are multiple modes, output the smallest one.


Input

The first line contains a natural number, n(1n105).

The second line contains n numbers separated by spaces.

Output

The solution of the problem in a single line.


Sample input 1

3
3 2 4

Sample output 1

2

Sample input 2

3
4 3 4

Sample output 2

4

Login to be able to submit.

MediumData structuresLoops
250 / 49
Solved / unsolved count
1.0 s / 512 MB
Limits