program random(input,output);
var
a:array[1..100]of integer;
i,j,k,s,n,m:integer;
begin
assign(input,'random.in');assign(output,'random.out');
reset(input);rewrite(output);
for i:=1 to 100 do
a[i]:=0;
readln(input,s);
read(input,a[1]);k:=1;
for i:=2 to s do begin
read(input,n);
j:=1;
while (j<=k) and (n>a[j])do j:=j+1;
if n<>a[j] then begin
for m:=k+1 downto j+1 do
a[m]:=a[m-1];
a[j]:=n;
k:=k+1;
end;
end;
writeln(output,k);
for i:=1 to k do
write(output,a[i],' ');
close(input);close(output);
end.