#include<stdio.h>
#include<queue>
using namespace std;
int n;
long long a[1500000005];
priority_queue<long long ,vector<long long>,greater<long long> > q;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
long long x;
scanf("%lld",&x);
if(!a[x]) a[x]=1,q.push(x);
else a[x]++;
}
while(!q.empty())
{
printf("%lld %lld\n",q.top(),a[q.top()]);
q.pop();
}
return 0;
}