URI Online Judge | 2469


By OBI - Olimpíada Brasileira de Informática 2014 BR Brazil

Timelimit: 1

Professor Archimedes needs your help to find out which is the most common notes between the notes that students took in his last race. The class has N students and your program must print the note that appears more often in N notes list. If more than more frequent note, you must print the biggest one! For example, if the class has N = 10 students and grades are [20, 25, 85, 40, 25, 90, 25, 40, 55, 40], the most common grades are 25 and 40, taking place three times each . Your program should then print 40.


The input consists of two lines. The first line contains an integer N, the number of students in the class. The second line contains N integers, which is the list of students' grades.


Your program must print a single line containing just a number, the most frequent note of the list.

Input Sample Output Sample

20 25 85 40 25 90 25 40 55 40