var i,t,n:longint; f,a:array[1..200000] of longint;
procedure qsort(r,l:longint);
var i,j,x,y:longint;
begin
i:=r;j:=l;x:=a[(r+l) div 2];
repeat
while a[i]<x do inc(i);
while a[j]>x do dec(j);
if i<=j then begin
y:=a[i];
a[i]:=a[j];
a[j]:=y;
inc(i);dec(j);
end;
until i>j;
if i<l then qsort(i,l);
if j>r then qsort(r,j);
end;
begin
assign(input,'pcount.in');
reset(input);
assign(output,'pcount.out');
rewrite(output);
readln(n);
for i:=1 to n do readln(a[i]);
qsort(1,n);
t:=1;
for i:=1 to 10000 do f[i]:=1;
for i:=1 to n do
if a[i]=a[i+1] then begin a[i]:=0;inc(f[t]); end
else inc(t);
t:=1;
for i:=1 to n do if a[i]<>0 then
begin
writeln(a[i],' ',f[t]);
inc(t);
end;
close(input);
close(output);
end.