program zad2;
    var
    a:array[1..1000000] of integer;
    i,f,l,d,max,p:integer;
    n:int64;
begin
   read(n) ;
    for i:=1 to n do
        begin
          read(a[i]);
        end;

for l:=1 to n-1 do  begin
  max:=a[l];
    for d:=l+1 to n do
         if (max<a[d]) and (f=0) then begin
              f:=1;
              p:=a[d];
              a[d]:=a[l];
              a[l]:=p;
           end;

         end;
for i :=1 to n do   write(a[i],' ');

  end.