program pcount;
type sz=array[1..200000]of longint;
var que:sz;
i,n,ji,tem:longint;
f1:text;
procedure qs(l,r:longint);
var i,j,x,y:longint;
begin
i:=l;
j:=r;
x:=que[(l+r) div 2];
repeat
while que[i]<x do
i:=i+1;
while x<que[j] do
j:=j-1;
if i<=j then
begin
y:=que[i];
que[i]:=que[j];
que[j]:=y;
i:=i+1;
j:=j-1;
end;
until i>j;
if l<j then qs(l,j);
if i<r then qs(i,r);
end;
begin
assign(f1,'pcount.in');
reset(f1);
readln(f1,n);
for i:=1 to n do
read(f1,que[i]);
qs(1,n);
close(f1);
assign(f1,'pcount.out');
rewrite(f1);
tem:=que[1]-1;
ji:=1;
for i:=1 to n do
if tem<>que[i] then
begin
if i<>1 then
writeln(f1,ji);
write(f1,que[i],' ');
tem:=que[i];
ji:=1;
end else inc(ji);
writeln(f1,ji);
close(f1);
end.