program cogs74;
var
a:array[1..1000] of 0..1000;
n,i,ans:integer;
procedure qsort(l,r:longint);
var
x,y,z:longint;
begin
x:=l;y:=r;z:=a[(l+r)div 2];
repeat
while a[x]<z do inc(x);
while a[y]>z do dec(y);
if y>=x then begin
i:=a[x];a[x]:=a[y];a[y]:=i;
inc(x); dec(y); end;
until x>y;
if x<r then qsort(x,r);
if y>l then qsort(l,y);
end;
procedure readin;
begin
assign(input,'random.in');reset(input);
assign(output,'random.out');rewrite(output);
readln(n);
for i:=1 to n do read(a[i]);
end;
procedure outputo;
begin
for i:=1 to n do
if a[i]=a[i+1] then continue
else inc(ans);
writeln(ans);
for i:=1 to n do
if a[i]=a[i+1] then continue
else write(a[i],' ');
close(input);close(output);
end;
begin
readin;
qsort(1,n);
outputo;
end.