Numbers

No attempts yetTime limit1sMemory limit128 MB

Problem

You are given $N$ positive integers $X_1, X_2, \ldots, X_N$. Write a program that finds the smallest value that appears at least as many times as every other number in the sequence (that is, a value whose frequency is maximal).

In other words, among all values that share the maximum frequency, output the smallest one.

Input

The first line contains a single integer $N$. Each of the next $N$ lines contains one integer $X_i$ (for $i = 1, 2, \ldots, N$).

Output

Print a single integer: the smallest value that appears at least as many times as any other number. Equivalently, if several values share the maximum frequency, print the smallest of them.

Constraints

  • $2 \le N \le 1000$
  • $1 \le X_i \le 10000$