program tongjishu;
var
i,j,t,n:longint;
a:array[1..200000]of longint;
procedure sort(l,r: longint);
var
i,j,x,y: longint;
begin
i:=l;
j:=r;
x:=a[(l+r) div 2];
repeat
while a[i]<x do
inc(i);
while x<a[j] do
dec(j);
if not(i>j) then
begin
y:=a[i];
a[i]:=a[j];
a[j]:=y;
inc(i);
j:=j-1;
end;
until i>j;
if l<j then
sort(l,j);
if i<r then
sort(i,r);
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]);
sort(1,n);
t:=1;
for i:=2 to n do
begin
if a[i]=a[i-1] then
inc(t)
else
begin
writeln (a[i-1],' ',t);
t:=1
end;
end;
writeln (a[n],' ',t);
close (input);
close (output)
end.