#C12336. Frequency List
Frequency List
Frequency List
Given a list of integers, your task is to compute the frequency of each distinct integer. Let be the number of integers and be the integers in the list. For every distinct integer, you need to form a tuple where is the integer and is its frequency. The output list of tuples must be sorted in descending order by frequency. In the case of ties (i.e. two integers have the same frequency), the tuple with the smaller integer (i.e. smaller ) should come first.
inputFormat
The input consists of two lines. The first line contains an integer , representing the number of elements in the list. The second line contains space-separated integers.
outputFormat
Output the frequency list. Each line should contain two integers separated by a space: the integer and its frequency, in the order specified.## sample
8
4 6 2 4 3 2 6 6
6 3
2 2
4 2
3 1
</p>