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