var l, r, j, t: Integer;
begin
comp:=0;
trans:=0;
l:= 1;
r:= n-1;
while l <= r do
begin
for j:=l to r do
if gt(items[j-1],items[j],comp) then
exch(items,j-1,j,trans);
dec(r);
for j:=r downto l do
if gt(items[j-1],items[j],comp)then
exch(items,j-1,j,trans);
inc(l);
end;