You are given an array of n integers. Find the value that appears the greatest number of times. If two or more values share the greatest count, print the smallest such value.
Input format
Line 1: an integer n.
Line 2: n space-separated integers, the array.
Output format
A single integer: the mode (smallest value among those with the highest frequency).
Constraints
- 1 <= n <= 100000
- -1000000000 <= each value <= 1000000000