for i:=2 to n do for j:=n downto i do begin if a[j-1]>a[j] then begin k:=a[j-1];a[j-1]:=a[j];a[j]:=k; end; end;