Processing math: 100%
Most Frequent Value - MarisaOJ: Marisa Online Judge

Most Frequent Value

Time limit: 1000 ms
Memory limit: 256 MB

You are given an array A of length n. Find the most frequently appear value in A.

Input

  • The first line contains an integer n.
  • The second line contains n integers Ai.

Output

  • Print a single integer, the most frequent value. If there are more than 1 result, print the largest value.

Constraints

  • 1≤n≤105.
  • |Ai|≤105.

Example

Input:

8
-1 2 3 2 2 3 -1 -1

Output:

2