#C894. Finding Modes

    ID: 52977 Type: Default 1000ms 256MiB

Finding Modes

Finding Modes

Given a list of integers, determine the mode(s) of the list. The mode is defined as the number(s) that occur most frequently. In the case where multiple numbers share the highest frequency, output all of them in ascending order.

Formally, if the list is denoted by \(A = [a_1, a_2, \ldots, a_n]\), you are to find all \(x\) such that the frequency \(f(x) = \max_{y \in A} f(y)\). Output these numbers in increasing order.

inputFormat

The input begins with an integer \(N\) indicating the number of elements in the list. The next line contains \(N\) space-separated integers.

outputFormat

Output the mode(s) of the list in ascending order, separated by a space. If the list is empty (i.e. \(N = 0\)), output nothing.

## sample
1
9
9

</p>