DMOPC '19 Contest 3 P1 - Mode Finding

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

You are given N numbers, a1,a2,,aN. Output all the modes of this list on a single line from least to greatest. The mode of a list is/are the value(s) that appear(s) the most times relative to the other values in the list. It is guaranteed that at least one mode exists.

Constraints

In all tests,
1N106
105ai105

Input Specification

The first line contains one number, N.
The second line contains N spaced integers, ai, the numbers in this list.

Output Specification

On one line, output the modes of the N numbers in increasing order.

Sample Input

Copy
10
9 2 9 6 8 7 1 3 9 6

Sample Output

Copy
9

Comments

There are no comments at the moment.