program random(input,output);
var
a:array [1..1010] of longint;
n,m,i,j,fu,x:longint;
procedure pai(head,tail:longint);
var
i,k,l,o:longint;
begin
i:=head;
l:=tail;
k:=a[(head+tail) div 2];
repeat
while a[i]<k do i:=i+1;
while a[l]>k do l:=l-1;
if i<=l then
begin
o:=a[i];
a[i]:=a[l];
a[l]:=o;
i:=i+1;
l:=l-1;
end;
until i>l;
if i<tail then pai(i,tail);
if head<l then pai(head,l);
end;
begin
assign(input,'random.in');
assign(output,'random.out');
reset(input);
rewrite(output);
readln(n);
for i:=1 to n do read(a[i]);
fu:=n;
pai(1,n);
x:=a[n];
for i:=1 to n do begin
if
(a[i]=a[i+1]) and (i<=fu)
then begin
a[i]:=0;
fu:=fu-1;
for j:=i to n do
a[j]:=a[j+1];
end;
end;
writeln(fu);
for i:=1 to fu do
write(a[i],' ');
close(input);
close(output);
end.