Program random;
Var
f1,f2:text;
n,k,i:integer;
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');reset(f1);
assign(f2,'random.out');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(f2);
End.