9090 - Mode   

Description

Mode means the most frequent value in a data set. Given a sequence of integers, find out their mode.

Input

There are several numbers of test cases.  Each case begins with an integer N (1 <= N <= 107). The next line contains N integers separated by a blank space. Each number is less than 1000 and greater than 0.  The input is terminated if N = 0.

Output

For each test case, print the mode of the sequence.  If the mode is not unique, print the smallest one.

Sample Input  Download

Sample Output  Download

Tags




Discuss