program random;
var n,i,ii,j,k,a:integer;
bb:array[1..1000]of boolean;
r:array[1..101]of integer;
b:boolean;
f1:text;
begin
assign(f1,'random.in');
reset(f1);
readln(f1,n);
for i:=1 to n do
begin
read(f1,a);
b:=false;
if not(bb[a]) then
begin
inc(ii);
for j:=1 to ii-1 do
begin
if a<r[j] then
begin
for k:=ii+1 downto j+1 do
r[k]:=r[k-1];
r[j]:=a;
b:=true;
break;
end;
end;
if not(b) then r[ii]:=a;
bb[a]:=true;
end;
end;
close(f1);
assign(f1,'random.out');
rewrite(f1);
writeln(f1,ii);
for i:=1 to ii do
write(f1,r[i],' ');
close(f1);
end.