Tiffin Time!Easy

Tiffin Time!

Easy+10 XP · +5 Aurahash mapcountingfrequency

It's lunchtime at UptoSkills Arena! Students bring their favourite tiffins (lunchboxes) to school. Each tiffin has a unique ID. You're given a list of all the tiffin IDs brought to school today. Your task is to find out which tiffin ID is the most common, meaning it appears the most times in the list. If there's a tie for the most common tiffin, output the smallest tiffin ID among those tied.

Input

The first line contains an integer N, the number of tiffins. The second line contains N space-separated integers, the tiffin IDs.

Output

Print a single integer: the ID of the most common tiffin, with ties broken by choosing the smallest ID.

Constraints

1 <= N <= 1000 0 <= tiffin_ID <= 10^9

Time limit 1 s (native code; slower languages get more)Memory 256 MB13 hidden tests

Example 1

Input
5
10 20 10 30 10
Output
10

Tiffin ID 10 appears 3 times, which is more than any other ID.

Example 2

Input
6
100 200 100 300 200 400
Output
100

Tiffin IDs 100 and 200 both appear twice. Since 100 is smaller than 200, it is chosen.

Hints