#CCBCHBAHAI0000172. Chim di cư (Migratory Birds)
Chim di cư (Migratory Birds)
Migratory Birds
Source: HackerRank
Version: Phuoc Hung OJ Extended
Problem
There are bird sightings. Sighting has a type ID .
For each ID , define
Find an ID with maximum frequency. If several IDs have the same maximum frequency, choose the smallest ID.
Input
- The first line contains .
- The second line contains .
Output
Print the required type ID.
Subtasks
Subtask 1 (20 points): and .
Subtask 2 (30 points): and .
Subtask 3 (50 points): and .
Example
Input
6
1 4 4 4 5 3
Output
4
Explanation
Type 4 occurs three times, more than any other type.