#include <fstream>
#include <algorithm>
#include <cmath>
using namespace std;
ifstream fi ("pcount.in");
ofstream fo ("pcount.out");
//typedef unsigned long long LL;
long long s[1000100];
int main()
{
int n,k=0;
fi>>n;
for (int i=0;i<n;i++)
fi>>s[i];
sort(s,s+n);
for (int i=0;i<n;i++)
if (s[i]!=s[i+1])
{
fo<<s[i]<<" "<<i-k+1<<endl;
k=i+1;
}
return 0;
}