11464 - Counting Sort   

Description

Given N integers X1, X2, ..., Xn. Please output the sorted result. (Increasing order)

Input

The input includes multiple test cases. In each test case, the first line contains one integers N. The next line contains N integers.

Hint:

The sorting algorithms in O(n lg n)  don’t work.

To avoid Time Limit Exceeded in Input/Output process, try to use scanf / printf to replace cin / cout.

1 <= N <= 2*107

0 <= Xi <= 104

Output

The one line conatins many pairs. Every pair (pi,qi) means there are pi numbers whose value are qi.

Sample Input  Download

Sample Output  Download

Tags




Discuss