O(2n^2)把相同的数变为0,冒泡排序。var i,j,k,l,f:longint; a:array[1..100] of longint;begin readln(l); for i:=1 to l do read(a[i]); for i:=1 to l-1 do for j:=i+1 to l do if (a[i]<>0)and(a[i]=a[j]) then begin a[j]:=0;inc(f);end; for i:=1 to l-1 do for j:=i+1 to l do if a[i]>a[j] then begin k:=a[j];a[j]:=a[i];a[i]:=k;end; writeln(l-f); for i:=f+1 to l do write(a[i],' ');end.