program random;
var
a:array[1..102] of integer;
n,i,j,q,s:longint;
fin,fout:text;
procedure init;
begin
readln(fin,n);
for i:=1 to n do read(fin,a[i]);
end;
procedure paixu;
var
temp:integer;
begin
for i:=1 to n-1 do
for j:=n downto i+1 do
if a[i]>a[j] then
begin
temp:=a[i];
a[i]:=a[j];
a[j]:=temp;
end;
end;
procedure print;
begin
q:=0;
for i:=1 to n do
begin
if (i=1) then
begin
s:=a[i];
inc(q)
end
else
if (i<>1) and (a[i]<>s) then
begin
inc(q);
s:=a[i];
end
else
begin
s:=a[i];
a[i]:=0;
end;
end;
writeln(fout,q);
for i:=1 to n-1 do
if a[i]<>0 then write(fout,a[i],' ');
write(fout,a[n]);
end;
begin
assign(fin,'random.in');
reset(fin);
assign(fout,'random.out');
rewrite(fout);
init;
paixu;
print;
close(fin);
close(fout);
end.