program tz;
var a:array[1..200001] of longint;
i,j,k,m,n:longint;f1,f2:text;
procedure qsort(s,t:longint);
var i,j,mid,temp:longint;
begin
i:=s;j:=t;mid:=a[(s+t) div 2];
while i<=j do
begin
while a[i]<mid do inc(i);
while a[j]>mid do dec(j);
if i<=j then
begin
temp:=a[i];a[i]:=a[j];a[j]:=temp;
inc(i);dec(j);
end;
end;
if i<t then qsort(i,t);
if j>s then qsort(s,j);
end;
begin
assign(f1,'punch.in');
assign(f2,'punch.out');
reset(f1);rewrite(f2);
readln(f1,n);
for i:=1 to n do readln(f1,a[i]);
qsort(1,n);
a[n+1]:=maxlongint;
k:=1;
for i:=2 to n+1 do
if a[i]<>a[i-1] then
begin writeln(f2,a[i-1],' ',k); k:=1;end
else k:=k+1;
close(f1);
close(f2);
end.