#C6162. Most Common Reading Time

    ID: 49892 Type: Default 1000ms 256MiB

Most Common Reading Time

Most Common Reading Time

You are given an array of integers representing participants' preferred reading times. Your task is to determine the time that has the highest number of participants willing to attend. In the event of a tie, return the smallest time.

Formally, given an array \(T\) of \(n\) integers, find the integer \(t\) that maximizes the frequency \(f(t)\). If there are multiple integers with the same maximum frequency, choose \(t = \min\{\text{all such times}\}\).

inputFormat

The input is given from stdin and consists of two lines. The first line contains a single integer \(n\) (\(1 \le n \le 10^5\)), representing the number of entries in the array. The second line contains \(n\) space-separated integers representing the array \(T\).

outputFormat

Output to stdout a single integer which is the time with the highest frequency. If there is a tie, output the smallest such time.

## sample
1
5
5

</p>