program bing;
var
f1,f2:text;
n,m:integer;
a:array[0..1000] of integer;
i,j,k:integer;
begin
assign(f1,'random.in');reset(f1);
assign(f2,'random.out');rewrite(f2);
readln(f1,n);
m:=n;
for i:=1 to n do
read(f1,a[i]);
for i:=1 to n-1 do
for j:=i+1 to n do
if a[j]<=a[i] then begin
k:=a[j];a[j]:=a[i];a[i]:=k;
end;
for i:=2 to n do
if a[i]=a[i-1] then m:=m-1;
writeln(f2,m);
write(f2,a[1],' ');
for i:=2 to n do
if a[i]<>a[i-1] then write(f2,a[i],' ');
close(f1);close(f2);
end.