AmazonOA #67
Sort Bug Report Frequencies
估计简单可在线判题
Sort all bug IDs in ascending order of frequency; ties in frequency are broken by ID in ascending order, and duplicates are kept.
输入格式
The first line contains n (1..200000), and the second line contains n IDs (1..1000000).
输出格式
Output the n sorted IDs.
样例 1
输入:
5
3 1 2 2 4
输出:
1 3 4 2 2
样例 2
输入:
2
2 1
输出:
1 2
样例 3
输入:
4
1 1 2 2
输出:
1 1 2 2
样例说明
Example 1: 1, 3, 4 each appear once and are output first by ID; 2 appears twice and goes last. Example 2: equal frequencies, output 1 2. Example 3: both frequencies are 2, output 1 1 2 2.