program ex;
type
ss=array[1..1000]of boolean;
var
a:ss;
f1,f2:text;
i:integer;
n,max,m,x:integer;
procedure init;
var
i:integer;
begin
assign(f1,'random.in');
assign(f2,'random.out');
reset(f1);
rewrite(f2);
readln(f1,n);
max:=0;
for i:=1 to n do
begin
read(f1,x);
if x>max then max:=x;
a[x]:=true;
end;
end;
procedure print;
var
i:integer;
begin
m:=0;
for i:=1 to max do
if a[i]=true then inc(m);
writeln(f2,m);
for i:=1 to max do
if a[i]=true then write(f2,i,' ');
end;
begin
init;
print;
close(f1);
close(f2);
end.