#B3875. Selection of the Little Flag Bearer

    ID: 11532 Type: Default 1000ms 256MiB

Selection of the Little Flag Bearer

Selection of the Little Flag Bearer

In the 2015 "Information and Future" Elementary Summer Camp held at Hongze Experimental Elementary School, the organizers decide to select a little flag bearer among the students. There are ( n ) students with student IDs from 1 to ( n ). Every student casts a vote to elect one student as the little flag bearer. The candidate receiving the most votes is selected. In the event of a tie (i.e. multiple candidates receiving the same maximum number of votes), the candidate with the smallest student ID is chosen.

For example, for ( n=8 ) and votes given as: 2, 3, 4, 4, 3, 4, 1, 6, the candidate with student ID 4 receives 3 votes which is the highest, and thus, student 4 is selected.

inputFormat

The input consists of two lines. The first line contains an integer ( n ) representing the number of students. The second line contains ( n ) space-separated integers where the ( i^{th} ) integer represents the vote cast by the ( i^{th} ) student.

outputFormat

Output the student ID of the elected little flag bearer.

sample

8
2 3 4 4 3 4 1 6
4