var
a,b:array[1..1000]of longint;
i,j,n,t,w,z:longint;
procedure qsort(l,r:longint);
var
i,j,x,y:longint;
begin
i:=l;j:=r;x:=a[(l+r) div 2];
repeat
while a[i]<x do inc(i);
while x<a[j] do dec(j);
if not(i>j) then
begin
y:=a[i];a[i]:=a[j];a[j]:=y;
inc(i);j:=j-1;
end;
until i>j;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;
begin
assign(input,'random.in');reset(input);
assign(output,'random.out');rewrite(output);
read(n);
for i:=1 to n do read(a[i]);
qsort(1,n);t:=1;z:=0;
while t<=n do
begin
z:=z+1;
b[z]:=a[t];w:=t+1;
while a[w]=a[t] do w:=w+1;
t:=w;
end;writeln(z);
for i:=1 to z do write(b[i],' ');
close(input);close(output);
end.