Program tz;
Var
n,k,i:integer;f1,f2:text;
a:array [1..100] of integer;
procedure Tsort(q:integer);
Var
temp:array [1..1000] of boolean;
i,j:integer;
Begin
k:=0;
fillchar(temp,sizeof(temp),false);
For i:=1 to q do
temp[a[i]]:=true;
fillchar(a,sizeof(a),0);
For i:=1 to 1000 do
if temp[i] then
Begin
inc(k);
a[k]:=i;
End;
End;
Begin
assign(f1,'random.in');
assign(f2,'random.out');
reset(f1);rewrite(f2);
readln(f1,n);
For i:=1 to n do read(f1,a[i]);
tsort(n);
writeln(f2,k);
For i:=1 to k-1 do write(f2,a[i],' ');
writeln(f2,a[k]);
close(f1);close(f2);
End.