Under construction

Still being built. Things may change

Cards

Interview

Time limit1sMemory limit256 MB

Summary
Count the N card values and print the most frequent one, breaking ties by the smaller value.
Level

Easy3 of 10

Topics
Hash map, Sorting
Solved
No attempts yet

Problem

Jungyu has NN number cards. Each card has one integer written on it, and that integer is at least −262-2^{62} and at most 2622^{62}.

Given the cards Jungyu holds, write a program that finds the integer he holds the most copies of. If several integers are tied for the largest count, print the smallest of them.

Input

The first line contains the number of cards NN (1≤N≤100,0001 \le N \le 100{,}000). Each of the next NN lines contains one integer written on a card.

Output

Print the integer that Jungyu holds the most copies of.

Examples2

  1. Example 1

    Input
    5
    1
    2
    1
    2
    1
    
    Expected output
    1
    
  2. Example 2

    Input
    6
    1
    2
    1
    2
    1
    2
    
    Expected output
    1