uses crt;
var z: char;
    indmin,i,j,pom,n:integer;
    pole:array[1..30] of integer;

begin
repeat
clrscr;
writeln('Trtkal 2008 - http://fei.trtkal.net');
writeln('-----------------------------------');
begin
     write('Zadej pocet prvku: ');readln(n);
     randomize;
     for i:=1 to n do
         begin
              pole[i]:=random(51)+50;
              write(pole[i],' ');
         end;
     writeln;
     for i:=1 to n-1 do
         begin
              indmin:=i;
              for j:=i+1 to n do
                  begin
                       if pole[j]<pole[indmin] then indmin:=j;
                  end;
              pom:=pole[i];
              pole[i]:=pole[indmin];
              pole[indmin]:=pom;
         end;
      for i:=1 to n do write(pole[i],' ');
      writeln;
end;
writeln('-----------------------------------');
write('Opakovat a/n: ');readln(z);
until (z='n');
end.