#C13324. Most Frequent Smallest Element

    ID: 42850 Type: Default 1000ms 256MiB

Most Frequent Smallest Element

Most Frequent Smallest Element

Given an array of integers, your task is to find the smallest element among those that appear most frequently. In other words, let the frequency of an element (x) be defined as (f(x)). You need to determine the element (x) such that (f(x)) is maximized, and if there are multiple elements with the same maximum frequency, choose the smallest one. If the array is empty, output (\text{None}).

inputFormat

The input is read from stdin. The first line contains an integer (n) that denotes the number of elements in the array. The second line contains (n) space-separated integers. If (n = 0), the array is empty.

outputFormat

Output, on a single line to stdout, the smallest element among those with the highest frequency. If the array is empty, output (\text{None}).## sample

1
1
1