#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector <int> array;
int main ( void ) {
int n, input;
while ( cin >> n ) {
for ( int i = 0; i < n; ++i ) {
cin >> input;
array.push_back ( input );
}
sort ( array.begin(), array.end() );
int cnt = 0;
for ( int i = 0; i < array.size(); ++i ) {
++cnt;
if ( array[i + 1] != array[i] ) {
cout << array[i] << " " << cnt << endl;
cnt = 0;
}
}
array.clear();
}
return 0;
}