#C10883. Find Most Frequent Integer

    ID: 40137 Type: Default 1000ms 256MiB

Find Most Frequent Integer

Find Most Frequent Integer

Given an array of integers, your task is to find the integer that appears most frequently. In case of a tie (i.e. more than one integer appears the maximum number of times), you must output the smallest one. If the array is empty, output (None).

The solution must read input from standard input (stdin) and write the answer to standard output (stdout).

inputFormat

The first line contains an integer (n) representing the number of elements in the array. The second line contains (n) space-separated integers.

outputFormat

Print a single integer that is the most frequent in the array. If there is a tie, print the smallest integer among them. If the array is empty, print (None).## sample

1
1
1