program pcount;
var
n,m:longint;
a:array[1..10000]of longint;
b:array[1..10000,1..2]of longint;
procedure ini;
var
i:longint;
begin
assign(input,'pcount.in');
reset(input);
assign(output,'pcount.out');
rewrite(output);
readln(n);
for i:=1 to n do
readln(a[i]);
close(input);
end;
procedure order;
var
temp,i,j:longint;
begin
for i:=1 to n do
for j:=i+1 to n do
if a[i]>a[j] then
begin
temp:=a[i];
a[i]:=a[j];
a[j]:=temp;
end;{then}
end;{order}
procedure count;
var
k,i,j:longint;
begin
k:=a[1];
b[1,1]:=k;
b[1,2]:=1;
i:=2;j:=1;
repeat
while a[i]=k do
begin
inc(b[j,2]);
inc(i);
end;{while}
if i<n then
begin
k:=a[i];
inc(j);
b[j,1]:=k;
b[j,2]:=1;
inc(i);
end;{then}
until i=n+1;
m:=j;
end;
procedure main;
begin
order;
count;
end;{main}
procedure print;
var
i:longint;
begin
for i:=1 to m do writeln(b[i,1],' ',b[i,2]);
close(output);
end;
begin
ini;
main;
print;
end.