Mediumhasharrays
Most Frequent Element
Time limit 2 s · Memory 64 MBAcceptance: —Solved by: 0
Statement
The first line contains n, the second line contains n integers. Print the value that occurs most often and its number of occurrences, separated by a space. If several values tie, choose the smallest one.
Examples
Example 1
Input
7 1 3 3 2 1 3 2
Output
3 3
Example 2
Input
6 2 2 1 1 3 3
Output
1 2
Constraints
- 1 ≤ n ≤ 10^5
- -10^9 ≤ a_i ≤ 10^9