NOIP '07 P1 - Counting Numbers
View as PDFA scientific survey obtained  natural numbers, each one at most 
 (
).
We know that there are at most  distinct numbers.
We want to count how many times each number appear, and output them in increasing order of the numbers.
Input Specification
Line  contains 
, the number of numbers, denoting the total number of numbers.
Lines  to 
 contain a number per line, denoting each number.
Output Specification
Output  lines (
 being the number of distinct numbers). Each contain two numbers, the value and the frequency.
Sample Input
8
2
4
2
4
5
100
2
100
Sample Output
2 3
4 2
5 1
100 2
Constraints
All data satisfy , each number is at most 
 (
).
 of the data satisfy 
.
 of the data satisfy 
.
Comments