#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
while(cin >> n){
map<int, int> mp;
while(n--){
int in; cin >> in;
mp[in]++;
}
for(auto it: mp)
cout << it.first << ' ' << it.second << endl;
}
}