var a:array[1..200000] of longint;
n,i,k,sum:longint;
procedure qsort(l,r:longint);
var i,j,k,t:longint;
begin
i:=l;j:=r;
k:=(l+r) div 2;
repeat
while a[i]<a[k] do inc(i);
while a[j]>a[k] do dec(j);
if i<=j then
begin
t:=a[j];
a[j]:=a[i];
a[i]:=t;
inc(i);
dec(j);
end;
until i>j;
if i<r then qsort(i,r);
if l<j then qsort(l,j);
end;
begin
readln(n);
for i:=1 to n do readln(a[i]);
qsort(1,n);
k:=-1;
for i:=1 to n do
if a[i]<>k then begin if i>1 then writeln(sum); write(a[i],' '); k:=a[i]; sum:=1; end
else inc(sum);
writeln(sum);
readln;
end.
program tongji;
var a:array[1..200000] of longint;
n,i,k,sum:longint;
procedure qsort(l,r:longint);
var i,j,k,t:longint;
begin
i:=l;j:=r;
k:=a[(l+r) div 2];
repeat
while a[i]<k do inc(i);
while a[j]>k do dec(j);
if i<=j then
begin
t:=a[j];
a[j]:=a[i];
a[i]:=t;
inc(i);
dec(j);
end;
until i>j;
if i<r then qsort(i,r);
if l<j then qsort(l,j);
end;
begin
readln(n);
for i:=1 to n do readln(a[i]);
qsort(1,n);
k:=-1;
for i:=1 to n do
if a[i]<>k then begin if i>1 then writeln(sum); write(a[i],' '); k:=a[i]; sum:=1; end
else inc(sum);
writeln(sum);
readln;
end.