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