#CCBCHBAHAI0000172. Chim di cư (Migratory Birds)

Chim di cư (Migratory Birds)

Migratory Birds

Source: HackerRank

Version: Phuoc Hung OJ Extended

Problem

There are nn bird sightings. Sighting ii has a type ID ai∈{1,2,3,4,5}a_i\in\{1,2,3,4,5\}.

For each ID vv, define

fv=∣{i∣ai=v}∣.f_v=\left|\{i\mid a_i=v\}\right|.

Find an ID with maximum frequency. If several IDs have the same maximum frequency, choose the smallest ID.

Input

  • The first line contains nn.
  • The second line contains a1,a2,…,ana_1,a_2,\ldots,a_n.

Output

Print the required type ID.

Subtasks

Subtask 1 (20 points): 5≤n≤205\le n\le 20 and ai∈{1,2,3,4,5}a_i\in\{1,2,3,4,5\}.

Subtask 2 (30 points): 5≤n≤10005\le n\le 1000 and ai∈{1,2,3,4,5}a_i\in\{1,2,3,4,5\}.

Subtask 3 (50 points): 5≤n≤2000005\le n\le 200000 and ai∈{1,2,3,4,5}a_i\in\{1,2,3,4,5\}.

Example

Input

6
1 4 4 4 5 3

Output

4

Explanation

Type 4 occurs three times, more than any other type.