var a: array of integer;
    i, s, j, k: integer;
begin
    readln(s);
    setlength(a, s);
    for i:=0 to s-1 do
        begin
            read(a[i]);
        end;
    for i:=0 to s-1 do
    begin
        for j:=0 to s-2 do
        if a[j]>a[j+1] then
            begin
                k:=a[j+1];
                a[j+1]:=a[j];
                a[j]:=k;
            end;
    end;
    for i:=0 to s-1 do
    write(a[i], ' ');
end.

var
n,i,j,t:integer;
a,k:array[1..100] of integer;
begin
readln(n);
for i:=1 to n do
read(a[i]);
for i:=1 to 100 do
for j:=1 to n do
if a[j]=i
    then inc(k[i]);
for i:=1 to 100 do
if k[i]<>0
   then for j:=1 to k[i] do
            writeln(i);
end.

var n,i:byte;
    a:array[1..100]of byte;
procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;
begin
    readln(n);
    for i:=1 to n do
      read(a[i]);
    sort(1,n);
    for i:=1 to n do
      write(a[i],' ');
    readln;
end.

var
  a,b,g : array [0..10000] of longint;
 h,i,l,k,j,n : longint;
begin
  readln(n);
  for i:=1 to n do read(a[i]);
  b:=a;
  for h:=1 to 100 do
   begin
    for j:=1 to n do
     if a[j]>=h then g[j]:=1
     else g[j]:=0;
    k:=0;
    for j:=1 to n do
     if g[j]=1 then inc(k);
    for j:=n downto n-k+1 do b[j]:=b[j]-g[j]+1;
    for j:=n-k downto 1 do
     if g[j]=1 then dec(b[j]);
   end;
  for i:=1 to n do write(b[i],' ');
end.

var a:array[1..100] of byte;
    n,i,j,tmp:byte;
begin
read(n);
for i:=1 to n do read(a[i]);
for i:=1 to n-1 do
for j:=i+1 to n do
        if a[i]>a[j] then
                begin
                tmp:=a[i];
                a[i]:=a[j];
                a[j]:=tmp;
                end;
for i:=1 to n do write(a[i],' ');
end.

Var
  i,j,n:integer;
  a:array[1..100] of integer;
Begin
  Read (n);
  for i:=1 to n do Read (a[i]);
  for j:=1 to n-1 do
    for i:=j+1 to n do
      if a[j]>a[i] then
      begin
      a[j]:=a[j]+a[i];
      a[i]:=a[j]-a[i];
      a[j]:=a[j]-a[i];
      end;
  for i:=1 to n do Write (a[i],' ');
End.

var
 i,j,n,t:longint;
 a:array[1..1000] of longint;
begin
 readln(n);
 for i:=1 to n do read(a[i]);
 for i:=1 to n-1 do
  for j:=i+1 to n do
   if a[i]>a[j] then
    begin
     t:=a[i];
     a[i]:=a[j];
     a[j]:=t;
    end;
  for i:=1 to n do write(a[i],' ');
end.

var n,i,j,t,k:longint;
a:array[1..100] of longint;
begin
  readln(n);
  for i:=1 to n do read(a[i]);
  for i:=1 to n-1 do
  for j:=i+1 to n do
  if a[i]>a[j] then
   begin
    t:=a[i];
    a[i]:=a[j];
    a[j]:=t;
   end;
   for k:=1 to n do write(a[k],' ');
end.

var
 i,n,j,m:integer;
 a:array[1..100]of integer;
begin
readln(n);
for i:= 1 to n do
read(a[i]);
 for i:=  1 to n-1 do
  for j:= 1 to n-i do
  if a[j]>a[j+1] then begin m:=a[j];a[j]:=a[j+1];a[j+1]:=m;end;
for i:= 1 to n do
write(a[i],' ');
end.

procedure QSort(var arr: array of integer);

    procedure sort(l, r: longint);
    var
      i, j, p, b: longint;
    begin
      if l<r then
      begin
        p := arr[random(r - l + 1) + l];
        i := l;
        j := r;
        while i < j do
        begin
          while arr[i] < p do
            Inc(i);
          while arr[j] > p do
            Dec(j);
          if i <= j then
          begin
            b := arr[i];
            arr[i] := arr[j];
            arr[j] := b;
            Inc(i);
            Dec(j);
          end;
        end;
        sort(l,j);
        sort(i,r);
      end;
    end;

  begin
    randomize;
    sort(0, high(arr));
  end;

var A:array of integer; i,n:integer;
BEGIN
   read(n);
   setlength(A,n);
   for i:= 0 to n-1 do read(A[i]);
   Qsort(A);
   for i:= 0 to n-1 do write(A[i],' ');
   readln;
   readln
END.

var flag:boolean;
    arr:array of byte;
    n,b,i:SHORTint;
BEGIN
   read(n);
   SetLength(arr,n);
   for i:=0 to n-1 do read(arr[i]);
   flag:=true;
   while flag do
   begin
      flag:=false;
      for i:=0 to n-2 do
         if arr[i]>arr[i+1] then
         begin
            b:=arr[i];
            arr[i]:=arr[i+1];
            arr[i+1]:=b;
            flag:=true;
         end;
   end;
   for i:=0 to n-1 do write(arr[i],' ');
END.

program cube;
var k,n,d,min,i:integer;
var a:array [1..100] of integer;
begin
  readln(n);
  for d:=1 to n do
  begin
    read(a[d]);
  end;
  for d:=1 to n-1 do
  begin
    k:=d;
    min:=a[d];
    for i:=d+1 to n do
    begin
      if a[i]<min then
      begin
        min:=a[i];
        k:=i;
      end;
    end;
    a[k]:=a[d];
    a[d]:=min;
  end;
  for d:=1 to n do
  begin
    write(a[d],' ');
  end;
end.

procedure QSORT(var A:array of integer);
   procedure sort(const l,h:integer);
   var i,j,pivot,b:integer;
   begin
      if l < h then
      begin
         pivot:=A[h];
         i:=l; j:=h;
         while i < j do
         begin
            while A[i] < pivot do inc(i);
            while pivot < A[j] do dec(j);
            if i <= j then begin
               b:=A[i];
               A[i]:=A[j];
               A[j]:=b;
               inc(i); dec(j);
            end
         end;
         sort(l,j);
         sort(i,h);
      end
   end;
begin
   sort(0,high(A));
end;
var A:array of integer; i,n:integer;
BEGIN
   read(n);
   setlength(A,n);
   for i:= 0 to n-1 do read(A[i]);
   Qsort(A);
   for i:= 0 to n-1 do write(A[i],' ');
END.

program gravity;
var
n,k,i,buf,j,m:integer;
A:array[1..10000] of integer;
begin
readln(n);
for i:=1 to n do
 begin
  read(A[i]);
 end;
for i:=1 to n-1 do
 begin
  for j:=1 to n-i do
    begin
     if A[j]>=A[j+1] then
      begin
       buf:=A[j];
       A[j]:=A[j+1];
       A[j+1]:=buf;
      end;
    end;
 end;
for i:=1 to n do
 begin
  write(A[i],' ');
 end;
end.

var a:array[1..100] of integer;
    k,n,i,j:integer;
begin
 read(n);
 for i:=1 to n do
 read(a[i]);
 for i:=1 to n do
  for j:=1 to n-i do
   if a[j]>a[j+1] then begin
                        k:=a[j];
                        a[j]:=a[j+1];
                        a[j+1]:=k;
                       end;
 for i:=1 to n do
  write(a[i],' ');
end.

var a:array[1..1000] of longint;
    n, i, mini, j, cc:longint;
begin

readln(n);

for i:=1 to n do
 read(a[i]);

for i:=1 to n-1 do
 begin
 mini:=i;

  for j:=i+1 to n do
  if a[j]<a[mini] then mini:=j;

 cc:=a[mini]; a[mini]:=a[i]; a[i]:=cc;
 end;

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

var a:array[1..1000000]of integer;n,i,j:integer;
begin
read(n);
for i:=1 to n do
read(a[i]);
for i:=1 to n do
for j:=i+1 to n do
if a[i]>a[j] then swap(a[i],a[j]);
for i:=1 to n do
write(a[i],' ')
end.

program ideone;
var a:array [1..100] of integer;
    i,j,b,n:integer;
begin
readln(n);
for i:= 1 to n do
 read(a[i]);
for i:= n-1 downto 1 do
 for j:= n downto i do
  if a[i] > a[j] then
   begin
   b:=a[i]-a[j];
   a[j]:=a[j]+b;
   a[i]:=a[i]-b;
   end;
for i:= 1 to n do
 write(a[i],' ');
end.

type
  a=array[0..100] of longint;
var
  i,n,j,max,ch,lie:longint;
  mas,tmp,mas1:a;
  s:string;
begin
  readln(n);
  max:=-1;
  for i:=1 to n do
    begin
     read(ch);
     if ch>max then
      max:=ch;
     mas[i]:=ch;
    end;
  for i:=1 to max do
    begin
      ch:=0;
      for j:=1 to n do
        if mas[j]>(i-1) then
          ch:=ch+1;
      mas1[i]:=ch;
    end;
 for i:=n downto 1 do
    begin
      ch:=0;
      for j:=1 to max do
        if mas1[j]>(i-1) then
          ch:=ch+1;
      write(ch, ' ');
    end;
end.

type
        TArr = array [1..100] of Integer;

procedure ReadArray (var a: TArr; n: Integer);
var
        i: Integer;

begin
        for i := 1 to n do
                Read (a[i]);
end;

procedure Swap (var a, b: Integer);
var
        t: Integer;

begin
        t := a;
        a := b;
        b := t;
end;

procedure BubbleSort (var a: TArr; n: Integer);
var
        i, j: Integer;

begin
        for i := 1 to n - 1 do
                for j := i + 1 to n do
                        if a[i] > a[j] then
                                Swap (a[i], a[j]);
end;

procedure WriteArray (const a: TArr; n: Integer);
var
        i: Integer;

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

        WriteLn;
end;

var
        a: TArr;
        n: Integer;

begin
        ReadLn (n);
        ReadArray (a, n);
        BubbleSort (a, n);
        WriteArray (a, n);
end.

var
mas:array[1..100] of longint;
N,k,i:longint;
Begin
read(N);
for i:=1 to N do
 read(mas[i]);
for i:=1 to N do
 for k:=1 to (N - 1) do
  if mas[k] > mas[k + 1] then
   swap(mas[k],mas[k + 1]);
for i:=1 to N do
  write(mas[i],' ');
ENd.

var
  n,i,j,t:longint;
  a:array[0..1000] of longint;
begin
  readln(n);
  for i:=1 to n do read(a[i]);
  for i:=1 to n-1 do
    for j:=i+1 to n do
    if a[i]>a[j] then begin t:=a[i];a[i]:=a[j];a[j]:=t;end;
  for i:=1 to n do write(a[i],' ');
end.

var
i,j,n,m:int64;
a:array [1..10000000] of int64;
begin
read(n);
for i:=1 to n do
read(a[i]);
for i:=1 to n do
for j:=1 to n do
if a[i]<a[j] then swap(a[i],a[j]);
for i:=1 to n do
write(a[i],' ');
end.

var
   a : array[1..150] of longint;
   i, j, n, k : longint;
begin
  read(n);
  for i := 1 to n do read(a[i]);
  for i := 1 to n - 1 do
   for j := i + 1 to n do
   if a[i] > a[j] then begin
                         k := a[i];
                         a[i] := a[j];
                         a[j] := k;
                       end;
  for i := 1 to n do write(a[i], ' ');
end.

const fi='';
      fo='';
Var a,b: array [1..100] of longint;
    n,i,j,d: longint;
    f,g: text;
procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;
Begin
    Assign(f,fi); Reset(f);
    Assign(g,fo); Rewrite(g);
    Readln(f,n);
    For i:=1 to n do
        Read(f,a[i]);
    sort(1,n);
    For i:=1 to n do
        Write(g,a[i],' ');
    Close(f); Close(g);
End.

var x:array[1..100] of integer;
    i:integer;
procedure sort(l,r:integer);
var
  i,j,x1,y1,m: integer;
begin
  i:=l;
  j:=r;
  m:=round ((l+r)/2);
  x1:=x[m];
  repeat
    while x[i]<x1 do inc(i);
    while x[j]>x1 do dec(j);
    if i<=j then
     begin
      y1:=x[i];
      x[i]:=x[j];
      x[j]:=y1;
      inc(i);
      dec(j);
     end;
  until i>j;
  if l<j then sort(l,j);
  if i<r then sort(i,r);
end;
 var n : Longint;
begin
  readln(n);
for i:=1 to n do
  begin
    read(x[i]);
  end;
sort(1,n);
for i:=1 to n do
write(x[i],' ');
end.

begin
  var n:integer;
  readln(n);
  var a:=arr(0)*n;
  for var i:=0 to n-1 do
    read(a[i]);
  for var i:=0 to n-1 do
    for var j:=n-2 downto i do
      if a[j]>a[j+1] then
      begin
        var c:=a[j];
        a[j]:=a[j+1];
        a[j+1]:=c;
      end;
   for var i:=0 to n-1 do
     print(a[i]);
end.

var n,i,j,t:integer;
    a:array[1..100]of integer;
begin
readln(n);
for i:=1 to n do
read(a[i]);
for i:=1 to n do
for j:=n downto i+1 do
if a[i]>a[j] then
begin
t:=a[i]-a[j];
a[i]:=a[i]-t;
a[j]:=a[j]+t;
end;
for i:=1 to n do write(a[i],' ');
end.

Var cut: array[1..100] of byte;
    n,i,aux: byte;
    sort: boolean;
Begin
Readln(n);
For i:=1 to n do
Read(cut[i]);
Repeat
sort:=true;
For i:=1 to n-1 do
if cut[i]>cut[i+1] then
begin
sort:=false;
aux:=cut[i]; cut[i]:=cut[i+1]; cut[i+1]:=aux;
End;
Until sort;
For i:=1 to n do
Write(cut[i],' ');
End.

program task;
 var n, i, j, p: integer; a: array[1..100] of integer;
begin
 readln(n);
 for i:=1 to n do read(a[i]);
 for i:=1 to n-1 do
 begin
  for j:=1 to n-i do
  begin
   if a[j]>a[j+1] then
   begin
    p:=a[j];
    a[j]:=a[j+1];
    a[j+1]:=p
   end
  end
 end;
 for i:=1 to n do write(a[i], ' ');
end.

const
MAXN = 1000000;
var
x,m,N,i:longint;
heap: array [1..MAXN] of longint;
procedure push(x,ind: longint);
var
  temp:longint;
begin
     heap[ind]:=x;
     while (ind>1) and (heap[ind div 2]>heap[ind]) do
     begin
          temp:=heap[ind div 2];
          heap[ind div 2]:=heap[ind];
          heap[ind]:=temp;
          ind:=ind div 2;
     end;
end;
function pop () :longint;
var
  ind,k,root,temp:longint;
begin
     ind:=1; root:=heap[1];
     heap[1]:=heap[N];
     while (2*ind<=N) do
     begin
          if (2*ind+1<=N) and (heap[2*ind+1]<heap[2*ind]) then k:=2*ind+1
          else k:=2*ind;
          if (heap[k]<heap[ind]) then
          begin
               temp:=heap[k div 2]; heap[k div 2]:=heap[k];
               heap[k]:=temp; ind:=k;
          end
          else break;
     end;
     dec(N);
     pop:=root;
end;
begin
     {lectura}
     readln(m);
     for i:=1 to m do
     begin
          read(x);
          push(x,i);
     end;
     N:=m;

     {ordenaciÃ³n por montÃculos y escritura}
     for i:=1 to m do
     begin
          write(pop(),' ');
     end;
     writeln;

     {readln(m);}
end.

type
  mas = array[1..100] of integer;

procedure sort(var massiv: mas; l, r: integer);
var
  i, mid: integer;
begin
  if l < r then
  begin
    mid := l;
    for i := l to r - 1 do
      if massiv[i] < massiv[r] then
      begin
        swap(massiv[i], massiv[mid]);
        inc(mid)
      end;
    swap(massiv[mid], massiv[r]);
    sort(massiv, l, mid - 1);
    sort(massiv, mid + 1, r);
  end;
end;

var
  chet, count: integer;
  massiv: mas;

begin
  read(count);
  for chet := 1 to count do
    read(massiv[chet]);
  sort(massiv, 1, count);
  for chet := 1 to count do
    write(massiv[chet], ' ');
end.

var
  n,i,j,a:integer;
  s:array[1..100] of integer;
begin
  read(n);
  for i :=1 to n do
    read(s[i]);
  for i:=1 to n-1 do
  for j:=i+1 to n do
  begin
    if s[i]>s[j] then
    begin
      a:=s[i];
      s[i]:=s[j];
      s[j]:=a;
    end;
  end;
  for i:=1 to n do
  write(s[i],' ');
end.

program Sort;

var a: array of integer;
i, n: integer;

procedure Merge(var a: array of integer; left, right: integer);
var middle, id, id_left, id_right, i: integer;
var b: array of integer;
begin
	Setlength(b, right - left + 1);

    middle := (left + right) div 2;
	id_left := left;
	id_right := middle + 1;
	id := 0;
	while (id_left <= middle) and (id_right <= right) do
	begin
	    if a[id_left] < a[id_right] then
		begin
			b[id] := a[id_left];
			id := id + 1;
			id_left := id_left + 1;
		end
		else
		begin
			b[id] := a[id_right];
			id := id + 1;
			id_right := id_right + 1;
		end
	end;
	while id_left <= middle do
	begin
		b[id] := a[id_left];
		id := id + 1;
		id_left := id_left + 1;
	end;
	while id_right <= right do
	begin
		b[id] := a[id_right];
		id := id + 1;
		id_right := id_right + 1;
	end;
	for i:=left to right do
		a[i] := b[i - left];
end;

procedure MergeSort(var a: array of integer; left, right: integer);
var middle: integer;
begin
	if left < right then
	begin
		middle := (left + right) div 2;
		MergeSort(a, left, middle);
		MergeSort(a, middle + 1, right);
		Merge(a, left, right);
	end;
end;

begin
	readln(n);
	setlength(a, n);
	for i:=0 to n-1 do
		read(a[i]);
	MergeSort(a, 0, n - 1);
	for i:=0 to n-1 do
		print(a[i]);
end.

Var i , j , n , tmp : Longint;
    A : Array [1..100] of Longint;

Begin
    Readln(n);
    For i := 1 to n do Read(A[i]);
    For i := 1 to n do
        For j := 1 to n do
            If A[i] < A[j] then
                Begin
                tmp := A[i];
                A[i] := A[j];
                A[j] := tmp;
                End;
    For i := 1 to n do Write(A[i] , ' ');
End.

program lol7;
var z,x,c,v,b,n,m,s,d,f,g,h,j,k,l,q,w,e,r,t,y,u,i,o,p: longint;
    a:array[1..10000] of longint;
begin
read(z);
for i:=1 to z do
begin
read(a[i]);
end;
for i:=1 to z-1 do
begin
     for j:=1 to z-i do
     begin
     if a[j]>a[j+1]
     then begin
          k:=a[j];
          a[j]:=a[j+1];
          a[j+1]:=k;
          end;
     end;
end;
for i:=1 to z do
begin
write(a[i],' ');
end;
end.

type ty = integer;
var a:array of ty;
i,n:integer;
begin
readln(n);
setlength(a,n);
for i:=0 to n-1 do
read(a[i]);
sort(a);
for i:=0 to n-1 do write(a[i],' ');
end.

var A:Array[1..100] of integer;
    j,i,N,t:integer;
begin
   readln(N);
   for i:=1 to N do
     read(A[i]);
    for i:=1 to N-1 do
      for j:=i+1 to N do
         if A[i]>A[j] then
            begin
            t:=A[i];
            A[i]:=A[j];
            A[j]:=t;
            end;
    for i:=1 to N do
     write(A[i],' ');
end.

program GRAVITY_FLIP;
var n,i:byte;
    a:array[1..100] of byte;
procedure bbsort;
var i1,j1,tam:byte;
   begin
    for i1:=1 to n-1 do
       for j1:=i1+1 to n do
         if a[i1] > a[j1] then
           begin
             tam:=a[i1];
             a[i1]:=a[j1];
             a[j1]:=tam;
           end;
   end;
begin
  readln(n);
  for i:=1 to n do read(a[i]);
  bbsort;
  for i:=1 to n do Write(a[i],' ');
  readln;
end.

var n,i,j,k,tam,t:longint;
              a:array[1..100]of longint;
begin
        readln(n);
        for i:=1 to n do
        read(a[i]);
        for t:=1 to n-1 do
        for j:=t+1 to n do
        if a[t] > a[j] then
        begin
        tam:=a[t];
        a[t]:=a[j];
        a[j]:=tam;
        end;
        for k:=1 to n do
        write(a[k],' ');
        readln;
end.

var
    a:array[1..101] of longint;
    i,j,t,n:longint;
begin
    readln(n);
    for i:=1 to n do
        read(a[i]);
    for i:=1 to n-1 do
        for j:=i+1 to n do
            if a[i]>a[j] then
            begin
                t:=a[i];
                a[i]:=a[j];
                a[j]:=t;
            end;
    for i:=1 to n do
        write(a[i],' ');
end.

var   a: array of Integer;
begin
  var n:=readinteger;
  a := new integer[n];
  for var i := 0 to n - 1 do
  a[i]:=readinteger;
  Sort(a);
  for var i := 0 to n - 1 do
  Print(a[i]);
end.

type
  tmas=array[1..100] of integer;

procedure swap(var a,b :integer);
var
  c :integer;
begin
  c:=a;
  a:=b;
  b:=c;
end;

procedure shift_down(var mas: tmas; index, n: integer);
var child, current: integer; stop: boolean;
begin
    current := mas[index];
    stop := false;
    while not stop and (index <= n div 2) do begin
        child := index * 2;
        if (child < n) and (mas[child] < mas[child + 1]) then
                child := child + 1;
        if current < mas[child] then begin
            mas[index] := mas[child];
            index := child;
        end else stop := true;
    end;
    mas[index] := current
end;

procedure heap_sort (var mas: tmas; n: integer);
var i: integer;
begin
    for i := n div 2 downTo 1 do
        shift_down(mas, i, n);
    for i := n downTo 1 do begin
        swap(mas[1], mas[i]);
        shift_down(mas, 1, i-1);
    end;
end;

var
  i,k,ch :integer;
  m :tmas;
begin
  read(k);
  for i:=1 to k do
  begin
    read(m[i]);
  end;
  heap_sort(m,k);
  for i:=1 to k do
  begin
    write(m[i],' ');
  end;
end.

var i,j,n,o:longint;
	a:array[1..1000000] of longint;
begin
readln(n);
for i:=1 to n do
	read(a[i]);
for i:=1 to n do
	for j:=n downto i+1 do
		if a[i]>a[j] then
			begin
			o:=a[i];
			a[i]:=a[j];
			a[j]:=o;
			end;
for i:=1 to n do
	write(a[i],' ');
end.

program gf;
   var a:array[1..100] of byte;
       n,t:byte;
procedure qsort(l,r:byte);
   var i,j,x,tam:byte;
begin
        i:=l;j:=r;
        x:=a[random(r-l+1)+l];
        repeat
                while a[i]<x do inc(i);
                while a[j]>x do dec(j);
                if (i<=j) then
                begin
                        tam:=a[i];
                        a[i]:=a[j];
                        a[j]:=tam;
                        inc(i);
                        dec(j);
                end;
        until i>j;
        if (i<r) then qsort(i,r);
        if (j>l) then qsort(l,j);
end;
begin
        readln(n);
        for t:=1 to n do read(a[t]);
        readln;
        qsort(1,n);
        for t:=1 to n do write(a[t],' ');
end.

program gravity;
var
a,i,j,c:integer;
b:array[1..1000] of integer;
begin
  read(a);
  for i:=1 to a do
    read(b[i]);
  if (a>1) then
    for i:=1 to a-1 do
      for j:=i+1 to a do
        if (b[i]>b[j]) then
        begin
          c:=b[i];
          b[i]:=b[j];
          b[j]:=c;
        end;
  for i:=1 to a do
    write(b[i],' ');
end.

var a:array[1..100]of integer;
s,i,j,t:integer;
begin
read(s);
for i:=1 to s do
begin
read(a[i]);
end;
for I:=1 to s do
begin
for j:=i+1 to s do
begin
if (a[i]<a[j])then begin
t:=a[i];
a[i]:=a[j];
a[j]:=t;
end;
end;
end;
for i:=s downto 1 do
write(a[i],' ');
end.

var a:array [1..1000] of longint;
 i,j,n:longint;
  procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

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

var n,i,j, max: LongInt;
a: array[1..1001] of LongInt;
b: array[1..101, 1..101] of LongInt;

procedure qsort(l,r: Longint);
var i,j,tmp,x: Longint;
begin
  i:=l; j:=r;
  x:=a[l+random(r-l+1)];
  repeat
     while a[i]<x do inc(i);
     while a[j]>x do dec(j);
     if i<=j then
     begin
       tmp:=a[i]; a[i]:=a[j]; a[j]:=tmp;
       inc(i);
       dec(j);
     end;
  until i>j;
  if i<r then qsort(i,r);
  if l<j then qsort(l,j);
end;

begin
  max:=0;
  Readln(n);
  for i:=1 to n do Read(a[i]);

  qsort(1,n);

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

var s:string;i,m,n,z,j,x,y:longint;a,b:array[0..1003]of longint;q:char;
begin
 read(n,a[1]);
 for i:=2 to n do
 begin
   read(X);
   j:=i-1;
   while a[j]>x do
   begin
    a[j+1]:=a[j];  ;dec(j);
   end;

    a[j+1]:=x;b[j+1]:=y;
   end;
 for i:=1  to n do

 write(a[i],' ');
end.

Program abc;
     Var n,i,j,k:integer;
     mas:array of integer;
begin
     readln(n);
     Setlength(mas,n+1);
     for i:=1 to n do read(mas[i]);
     for j:=1 to n do
     begin
          for i:=1 to n-1 do
          begin
               if(mas[i]>mas[i+1]) then
               begin
                    k:=mas[i];
                    mas[i]:=mas[i+1];
                    mas[i+1]:=k;
               end;
          end;
     end;
          for i:=1 to n do write(mas[i],' ');
end.

var n, i, j, T : longint;
    A : array[1..100] of longint;
begin
     readln(n);
     For i := 1 to n do
         read(A[i]);
     For i := 1 to n do
         For j := 1 to n-1 do
             If A[j] > A[j+1] then
             begin
                T := A[j];
                A[j] := A[j+1];
                A[j+1] := T;
             end;
     write(A[1]);
     For i := 2 to n do write(' ',A[i]);
     writeln;
end.

var
  i,j,n,t: integer;
  a: array[1..4] of integer;
begin
  readln(n);
  for i := 1 to n do read(a[i]);
  for i := 1 to n-1 do
    for j := 1 to n-i do
      if a[j] > a[j+1] then begin
        t := a[j];
        a[j] := a[j+1];
        a[j+1] := t;
      end;
  for i := 1 to n do write(a[i],' ')
end.

program z_A;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  n,m,i,j,t:longint;
  mas:array[1..101] of longint;
begin
  readln(n);
  for i:=1 to n do begin
    read(mas[i]);
  end;
  for i:=1 to n do begin
    t:=0;
    for j:=1 to n-1 do begin
      if mas[j]>mas[j+1] then begin
        t:=mas[j+1];
        mas[j+1]:=mas[j];
        mas[j]:=t;
        t:=1;
      end;
    end;
    if t=0 then break;
  end;
  for i:=1 to n do write(mas[i],' ');
  writeln;
end.

program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
var
a: array[1..1000] of integer;
r: array[1..1000] of integer;
n,i:integer;

procedure sort;
var
i,j,buf,min,x:integer;
begin
for i:=1 to n-1 do//смотрим элементы массива с первого
for j:=i+1 to n do//сравниваем с элементами, которые впереди
 if a[i]>a[j] then//если нашли впереди меньше,
  begin
    x:=a[i];//то с помощью переменной-буфера
    a[i]:=a[j];//меняем элементы местами
    a[j]:=x;
  end;
end;

begin
readln(n);
for i:=1 to n do read(a[i]);
sort;
for I := 1 to n do write(a[i],' ');
readln;
readln;
end.

{$R-,S-,Q-,I-,O+}
{$M 32000000}

{$APPTYPE CONSOLE}

uses Math;
const
    inf = round(1e9);
    maxn = round(1e5) + 200;
    md = round(1e9) + 7;
var
    n, i, x, need, j : longint;
    h, ans : array [1..111] of longint;
begin
  //assign (input, 'input.txt'); reset(input);
  //assign (output, 'output.txt'); rewrite(output);
  randomize;
  fillchar(h, sizeof(h), 0);
  readln(n);
  for i := 1 to n do
  begin
    read(x);
    for j := 1 to x do inc(h[j]);
  end;
  for i := n downto 1 do
  begin
    ans[i] := 0;
    need := n - i + 1;
    for j := 1 to 111 do
    if h[j] >= need then inc(ans[i]);
  end;
  for i := 1 to n do write(ans[i],' ');
end.

var a:array[1..100] of integer;
n,i:integer;

procedure qsort (var a:array of integer;low,high:integer);
var i,j,k,p:integer;
begin
i:=low; j:=high; k:=a[(i+j) div 2];
repeat
while a[i] < k do i:=i+1;
while a[j] > k do j:=j-1;
if i<=j then begin
p:=a[i]; a[i]:=a[j]; a[j]:=p;
i:=i+1;
j:=j-1;
end;
until i>j;
if low < j then qsort(a,low,j);
if high>i then qsort(a,i,high);

end;

begin
readln(n);
for i:= 1 to n do read(a[i]);
qsort(a,0,n-1);
for i:=1 to n do write(a[i],' ');
end.

var
n,k,a,j:integer;
m:array[1..100]of integer;
begin
read(n);
for k:=1 to 100 do
begin
read(a);
m[a]:=m[a]+1;
end;
for k:=1 to 100 do
if m[k]<>0 then
for j:=1 to m[k] do write(k,' ');
end.

program Project2;
{$APPTYPE CONSOLE}
var
i,j,n,k:longint;
a:array[0..1000] of longint;
begin
//assign (input, 'input.txt');
//reset (input);
//assign (output, 'output.txt');
//rewrite (output);
read(n);
for i:=1 to n do read(a[i]);
for I := 1 to n do
  for j := 1 to n-i do
    if a[j]>a[j+1] then begin
     k:=a[j];a[j]:=a[j+1];a[j+1]:=k;
    end;
for I := 1 to n do write(a[i],' ');

end.

const   f1='405a.inp';
        f2='405a.out';
var     i,n:longint;
        a:array[1..1000000] of longint;

procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;
begin
        //assign(input,f1);reset(input);
        //assign(output,f2);rewrite(output);

        readln(n);
        for i:=1 to n do read(a[i]);
        sort(1,n);

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

Var a,b:array[1..10000] of longint;
    i,j,k,m,l,o,p,n:longint;

 procedure rec(x:longint);
  begin
   if a[x]>a[x+1] then begin
                        k:=a[x+1];
                        a[x+1]:=a[x];
                        a[x]:=k;

                        if x<n-1 then rec(x+1);
                        if x>1 then rec(x-1);
                       end;
  end;

 Begin
  read(n);
  for i:=1 to n do
   begin
    read(a[i]);
   end;
  for i:=n-1 downto 1 do
   begin
    rec(i);
   end;
  for i:=1 to n do write(a[i],' ');
 ENd.

program ProjectA;

{$APPTYPE CONSOLE}

uses
  SysUtils;
type mass=array[1..100]of integer;
var i,n,a,b,j,max:integer; m,k:mass;
begin
{ reset(input,'input.txt');
 rewrite(output,'output.txt');
 }readln(n);
 max:=0;
 for i:=1 to n do
  begin
   read(m[i]);
   if m[i]>max
   then max:=m[i];
  end;

 for i:=1 to max do
  begin
   for j:=1 to n do
    if m[j]>=i
    then inc(k[i]);
  end;
 for i:=n downto 1 do
  begin
   a:=0;
   for j:=1 to max do
    if k[j]>=i
    then inc(a);
   write(a,' ');
  end;
end.

var j,n,i,d,k:longint;
a:array[1..10000000] of longint;
begin
readln(n);
for i:=1 to n do
read(a[i]);
for i:=1 to n-1 do begin
  for j:=1 to n-i do begin
    if a[j]>a[j+1] then begin
      k:=a[j];
      a[j]:=a[j+1];
      a[j+1]:=k;
    end;
  end;
end;
for i:=1 to n do
write(a[i],' ');
end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type TArray=Array [1..110] of Integer;
var
  i,n,m:integer;
  A:TArray;

procedure qSort(var A: TArray; min, max: Integer);
var i, j, supp, tmp: Integer;
begin
supp:=A[max-((max-min) div 2)];
i:=min; j:=max;
while i<j do
  begin
    while A[i]<supp do i:=i+1;
    while A[j]>supp do j:=j-1;
    if i<=j then
      begin
        tmp:=A[i]; A[i]:=A[j]; A[j]:=tmp;
        i:=i+1; j:=j-1;
      end;
  end;
if min<j then qSort(A, min, j);
if i<max then qSort(A, i, max);
end;

begin
  readln(n);
  for i:=1 to n do
    read(A[i]);
  writeln('');
  m:=1;
  QSort(A,m,n);
  for i:=1 to n do
    write(A[i],' ');
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  mas:array of Integer;
  n,i,j,h,l:Integer;
  bol:Boolean=true;
begin
  Readln(n);
  SetLength(mas,n+1);

  for i:=1 to n do
    Read(mas[i]);

  repeat
    bol:=false;
    for i:=1 to n do
    for j:=i+1 to n do
      if mas[i]>mas[j] then
      begin
        l:=mas[i];
        mas[i]:=mas[j];
        mas[j]:=l;
        bol:=true;
      end;
  until not bol;

  for i:=1 to n do
  if i<>n then Write(mas[i],' ')
  else Write(mas[i]);

  Readln(i);

end.

//const fi ='xoa.inp';
var fd:text;
    a:array[0..1000] of longint;
    i,j ,n, t:longint;
begin
  //  assign(fd, fi); reset(fd);
    readln(n);
    for i:=1 to n do
      read( a[i]);
    for i:=1 to n-1 do
      for j:=i+1 to n do
        if a[i] > a[j] then
          begin
             t:=a[i]; a[i] := a[j]; a[j] :=t;
          end;
    for i:=1 to n do
       write(a[i],' ');
    //close(fd);
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const oo=1e+21;
      eps=1e-9;
      dohuya=maxlongint div 2;

var ss,sss:array[0..201500]of string;
    s,s0,s1,s2,s3:string;
    a,aaa:array[0..2015,0..2015]of longint;
    qq,cc,qc:array[0..1000000]of longint;
    q,c,q0,c0,q1,c1,q2,c2,q3,c3,r,res,cur,n,m,i,j,k:longint;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;
    ch:char;
    b,bb:boolean;

begin
read(n);
for i:=1 to n do read(qc[i]);
for i:=1 to n do
  for j:=i+1 to n do
    begin
    if qc[i]>qc[j]  then begin qc[0]:=qc[i]; qc[i]:=qc[j]; qc[j]:=qc[0]; end;
    end;
for i:=1 to n do write(qc[i],' ');
end.

{$MODE OBJFPC}
program column;

const
  inp = '';
  outp = '';
  maxN = Round(1E2+2);

var
  pb,pb2: Text;
  {input}
  n: Integer;
  a: array [0..maxN] of Integer;
  {main}

  {output}

procedure INPUT;
var i: Integer;
begin
  Assign(pb,inp); Reset(pb);
  Assign(pb2,outp); ReWrite(pb2);
  ReadLn(pb,n);
  for i := 1 to n do Read(pb,a[i]);
end;

procedure QS(L,H: Integer);
var i,j: Integer;
    key,t: Integer;
begin
  i := Random(H-L+1)+L;
  key := a[i];
  i := L; j := H;
  while (i<=j) do
  begin
    while (a[i]<key) do Inc(i);
    while (a[j]>key) do Dec(j);
    if (i<=j) then
    begin
      t := a[i]; a[i] := a[j]; a[j] := t;
      Dec(j); Inc(i);
    end;
  end;
  if (L<j) then QS(L,j);
  if (i<H) then QS(i,H);
end;

procedure MAIN;
begin
  QS(1,n);
end;

procedure OUTPUT;
var i: Integer;
begin
  for i := 1 to n do Write(pb2,a[i],' ');
  Close(pb); Close(pb2);
end;

BEGIN
  INPUT;
  MAIN;
  OUTPUT;
END.

var n,i,j,c:longint;
    a:array[1..100] of longint;
begin
read(n);
for i:=1 to n do
  read(a[i]);
for i:=1 to n-1 do
  for j:=1 to n-1 do
    begin
       if a[j]>a[j+1] then
          begin
            c:=a[j];
            a[j]:=a[j+1];
            a[j+1]:=c;
          end;
    end;
for i:=1 to n do
  write(a[i],' ');
end.

program baitap;
var a: array[1..101] of integer;
    n,i,j,t: integer;
begin
readln(n);
for i := 1 to n do read(a[i]);
for i:= 1 to n-1 do
    for j:= i+1 to n do
    begin
        if a[i] > a[j] then
           begin
               t := a[i];
               a[i] := a[j];
               a[j] := t;
           end;
    end;
for i:=1 to n do write(a[i],' ');
readln;
end.

VAR
        i,j,n,k : longint;
        a : array[1..100] of longint;
BEGIN
        readln(n);
        for i := 1 to n do read(a[i]);
        for i := 1 to n-1 do
                for j := i+1 to n do
                        if a[i] > a[j] then
                        begin
                                k := a[i];
                                a[i] := a[j];
                                a[j] := k;
                        end;
        for i := 1 to n do
                write(a[i],' ');
END.

program kkkkk;
var
i,k,n:byte;
x:boolean;
mas:array of byte;

begin
read(n);
setlength(mas,n+1);
for i:=1 to n do
read(mas[i]);
x:=true;

while x do
begin
for i:=n downto 2 do
if mas[i]<mas[i-1] then begin x:=false; k:=mas[i-1]-mas[i]; mas[i-1]:=mas[i-1]-k; mas[i]:=mas[i]+k; end;
x:=not(x);
end;

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

end.

{$MODE OBJFPC}
program OnlyLove;
var a ,b: array[0..101] of integer;
    n : integer;
procedure enter;
   var i : integer;
   begin
      readln(n);
      for i:=1 to n do Read(a[i]);
   end;
procedure sort;
    var i ,j ,w:integer;
    begin
       a[0]:=0;
       a[n+1]:=101;
       for i:=1 to n-1 do
         for j:=i+1 to n do
            if a[i] > a[j]  then
                begin
                    w:=a[i];
                    a[i]:=a[j];
                    a[j]:=w;
                end;
    end;
procedure solve;
   var i ,j : integer;
   begin
      sort;
      for i:=1 to n do
         begin
             Write(a[i],' ');
         end;
   end;
begin
  enter;
  solve;
end.

var
a:array[0..105] of integer;
n,i,j,t:integer;
begin
readln(n);
for i:=1 to n do read(a[i]);
for i:=1 to n-1 do
  for j:=i+1 to n do
    if a[i]>a[j] then
      begin
        t:=a[i];
        a[i]:=a[j];
        a[j]:=t;
      end;
for i:=1 to n do write(a[i],' ');
end.

Var a:array[1..100] of longint;
i,n:longint;
procedure sort(L,R:longint);
Var i,j,x,t:longint;
begin
i:=L;
j:=R;
x:=a[(L+R)div 2];
repeat
while a[i]<x do inc(i);
while a[j]>x do dec(j);
if i<=j then begin
             t:=a[i];
             a[i]:=a[j];
             a[j]:=t;
             inc(i);
             dec(j);
           end;
until i>j;
if L<j then sort(L,j);
if i<R then sort(i,R);
end;
begin
readln(n);
for i:=1 to n do
read(a[i]);
sort(1,n);
for i:=1 to n do
write(a[i],' ');
end.

var
 a: array[0..100] of longint;
 n,b,i,j:longint;
begin
 readln(n);
 for i:=1 to n do
 begin
  read(b);
  inc(a[b]);
 end;
 for i:=0 to 100 do
 for j:=1 to a[i] do write(i,' ');
end.

program korob;
var  a,b:array[1..100] of integer;
i,n,j,max:integer;
begin
readln(n);
for i:=1 to 100 do
b[i]:=0;
max:=-1;
for i:=1 to n do
begin
        read(a[i]);
        if max<a[i] then max:=a[i];
        for j:=1 to a[i] do

     inc(b[j]);
end;
for i:=1 to n do
a[i]:=0;
for i:=1 to max do
for j:=1 to b[i] do
inc(a[j]);
for i:=n downto 1 do
write(a[i],' ');
end.

var a:array[1..100] of longint;
n,c,i,j:longint;
begin
readln(n);
for i:=1 to n do
read(a[i]);
for i:=1 to n do
for j:=1 to n do
if a[i]<a[j] then
begin
c:=a[i];
a[i]:=a[j];
a[j]:=c;
end;
for i:=1 to n do
write(a[i],' ');
end.

   var a:array[-100..100] of longint; j,f,i,i1,n,o,m,d,p,k:longint; b:array[-100.. 100] of longint;
begin
readln(n);
for i:=1 to n do
read(a[i]);
for i:=1 to n do
b[a[i]]:=b[a[i]]+1;
for i:=-100 to 100 do
begin
if b[i]<>0 then
begin
for i1:=1 to b[i] do
write(i,' ');
end;
end;
end.

var n:byte;
    i:longint;
    a:Array[1..100] of byte;
procedure sort(l,r: longint);
var i,j,x,y: longint;
begin
    i:=l;
    j:=r;
    x:=a[(l+r) div 2];
    repeat
        while a[i]<x do inc(i);
        while x<a[j] do dec(j);
        if not(i>j) then
            begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
            end;
    until i>j;
    if l<j then sort(l,j);
    if i<r then sort(i,r);
end;
begin
    //Input
    readln(n);
    for i:= 1 to n do read(a[i]);
    sort(1,n);
    for i:= 1 to n do write(a[i],' ');

end.

const   fi      =       '';
        fo      =       '';
        maxN    =       100;
type    int     =       integer;
var     n       :       int;
        a       :       array[0..maxN,1..maxN]  of      int;
{}
procedure xl;
var i,j,d,c: int;
begin
        for j:=1 to n do for i:=1 to a[0][j] do a[i,j] := 1;
        for i:=1 to 100 do
            begin
                 d := 1; c := n;
                 while d<c do
                    begin
                         while (a[i,d]=0)and(d<=n) do inc(d);
                         while (a[i,c]=1)and(1<=c) do dec(c);
                         if d<c then
                             begin
                                    a[i,d] := 0; a[i,c] := 1;
                                    dec(a[0,d]); inc(a[0,c]);
                             end;
                    end;

            end;
        assign(output,fo);      rewrite(output);
        for i:=1 to n do write(a[0,i],' ');
        close(output);
end;
{}
procedure docdl;
var i : int;
begin
        assign(input,fi);       reset(input);
        fillchar(a,sizeof(a),0);
        readln(n);
        for i:=1 to n do read(a[0,i]);
        close(input);
end;
{}
begin
        docdl;
        xl;
end.

var a:array[1..105] of longint; min,i,i1,n,o,k,s,s1:longint;
begin
readln(n);
for i:=1 to n do
  read(a[i]);
for i:=1 to n-1 do
  for i1:=1 to n-i do
    if a[i1]>a[i1+1] then
      begin
       o:=a[i1];
       a[i1]:=a[i1+1];
       a[i1+1]:=o;
      end;
for i:=1 to n do
  write(a[i],' ');
end.

Var a,b:array[1..10000] of longint;
    i,j,n,m,k,t:longint;
 begin
  Read(n);
  for i:=1to n do
   Read(a[i]);
  for t:=1 to 100 do
  for i:=n-1 downto 1 do
   begin
    if a[i]>a[i+1] then
     begin
      k:=i+1;
      for j:=i+1 to n do
       if a[i]<=a[j] then break else inc(k);
      dec(k);
      inc(a[k]);
      dec(a[i]);
     end;
   end;
 for i:=1 to n do
  Write(a[i],' ');
 end.

Var a,b:array[1..10000] of longint;
    i,j,n,m,k,t:longint;
 begin
  Read(n);
  for i:=1to n do
   Read(a[i]);
  for t:=1 to 1000 do
  for i:=n-1 downto 1 do
   begin
    if a[i]>a[i+1] then
     begin
      k:=i+1;
      for j:=i+1 to n do
       if a[i]<=a[j] then break else inc(k);
      dec(k);
      inc(a[k]);
      dec(a[i]);
     end;
   end;
 for i:=1 to n do
  Write(a[i],' ');
 end.

VAR
        i,j,n,k : longint;
        a : array[1..100] of longint;
BEGIN
        readln(n);
        for i := 1 to n do read(a[i]);
        for i := 4 downto 1 do
                for j := n downto 1 do
                        if a[j] = i then
                                for k := n downto j+1 do
                                        if a[k] < a[j] then
                                        begin
                                                a[k] := a[k]+1;
                                                a[j] := a[j]-1;
                                        end;
        for i := 1 to n do
                write(a[i],' ');
END.

{$MODE OBJFPC}
program OnlyLove;
var a ,b: array[0..101] of integer;
    n : integer;
procedure enter;
   var i : integer;
   begin
      readln(n);
      for i:=1 to n do Read(a[i]);
   end;
procedure sort;
    var i ,j ,w:integer;
    begin
       a[0]:=0;
       a[n]:=101;
       for i:=1 to n-1 do
         for j:=i+1 to n do
            if a[i] > a[j]  then
                begin
                    w:=a[i];
                    a[i]:=a[j];
                    a[j]:=w;
                end;
    end;
procedure solve;
   var i ,j : integer;
   begin
      sort;
      for i:=1 to n do
         begin
             Write(a[i],' ');
         end;
   end;
begin
  enter;
  solve;
end.

var i,n,j:longint;
a,b,c:array[1..101]of longint;

begin
read(n);
for i:=1 to n do
read(a[i]);

for i:=1 to n do
for j:=1 to n do
if a[j]>=i then inc(b[i]);

for i:=1 to n do
for j:=1 to n do
if n-b[j]+1<=i then inc(c[i]);

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

end.

Program GravityFlip;
Var i,n:longint;
    m:array [0..101] of longint;
Procedure swap(var a,b:longint);
Var tmp:longint;
Begin
tmp:=a;
a:=b;
b:=tmp;
End;

Procedure sort(l,h:longint);
Var i,j,x:longint;
Begin
    i:=l; j:=h; x:=m[(l+h) div 2];
    Repeat
    While m[i]>x do inc(i);
    While m[j]<x do dec(j);
    If i<=j Then begin
       swap(m[i],m[j]);
       inc(i);
       dec(j);
    end;
    Until i>j;
    If l<j Then sort(l,j);
    If i<h then sort(i,h);
End;

Begin
    Read(n);
    For i:=1 to n do
    Read(m[i]);
    sort(1,n);
    For i:=1 to n do
    Write(m[i]);
End.

Program Buisenesstrip;
Var i,k,t:longint;
    m:array [0..13] of longint;
    xet:boolean;
Procedure input;
Begin
    Read(k);
    For i:=1 to 12 do
        Read(m[i]);
End;

Procedure swap(var a,b:longint);
Var tmp:longint;
Begin
tmp:=a;
a:=b;
b:=tmp;
End;

Procedure sort(l,h:longint);
Var i,j,x:longint;
Begin
    i:=l; j:=h; x:=m[(l+h) div 2];
    Repeat
    While m[i]>x do inc(i);
    While m[j]<x do dec(j);
    If i<=j Then begin
       swap(m[i],m[j]);
       inc(i);
       dec(j);
    end;
    Until i>j;
    If l<j Then sort(l,j);
    If i<h then sort(i,h);
End;

Begin
    input;
    sort(1,12);
    t:=0;
    i:=0;
    xet:=true;
    While t<k do begin
        inc(i);
        t:=t+m[i];
        If i>12 Then Begin
        xet:=false; Break; End;
    end;
    If xet Then Write(i) Else Write('-1');
End.

const   fi      =       '';
        fo      =       '';
        maxN    =       100;
type    int     =       integer;
var     n       :       int;
        a       :       array[0..maxN,1..maxN]  of      int;
{}
procedure xl;
var i,j,d,c: int;
begin
        for j:=1 to n do for i:=1 to a[0][j] do a[i,j] := 1;
        for i:=1 to 100 do
            begin
                 d := 1; c := n;
                 while d<c do
                    begin
                         while (a[i,d]=0)and(i<=n) do inc(d);
                         while (a[i,c]=1)and(1<=c) do dec(c);
                         if d<c then
                             begin
                                    a[i,d] := 0; a[i,c] := 1;
                                    dec(a[0,d]); inc(a[0,c]);
                             end;
                    end;

            end;
        assign(output,fo);      rewrite(output);
        for i:=1 to n do write(a[0,i],' ');
        close(output);
end;
{}
procedure docdl;
var i : int;
begin
        assign(input,fi);       reset(input);
        fillchar(a,sizeof(a),0);
        readln(n);
        for i:=1 to n do read(a[0,i]);
        close(input);
end;
{}
begin
        docdl;
        xl;
end.

const   fi      =       '';
        fo      =       '';
        maxN    =       100;
type    int     =       integer;
var     n       :       int;
        a       :       array[0..maxN,1..maxN]  of      int;
{}
procedure xl;
var i,j,d,c: int;
begin
        for j:=1 to n do for i:=1 to a[0][j] do a[i,j] := 1;
        for i:=1 to n do
            begin
                 d := 1; c := n;
                 while d<c do
                    begin
                         while (a[i,d]=0)and(i<=n) do inc(d);
                         while (a[i,c]=1)and(1<=c) do dec(c);
                         if d<c then
                             begin
                                    a[i,d] := 0; a[i,c] := 1;
                                    dec(a[0,d]); inc(a[0,c]);
                             end;
                    end;

            end;
        assign(output,fo);      rewrite(output);
        for i:=1 to n do write(a[0,i],' ');
        close(output);
end;
{}
procedure docdl;
var i : int;
begin
        assign(input,fi);       reset(input);
        fillchar(a,sizeof(a),0);
        readln(n);
        for i:=1 to n do read(a[0,i]);
        close(input);
end;
{}
begin
        docdl;
        xl;
end.

{$H+}
var
  n, d, i, j : longint;
  a, o : array[1..100] of longint;
begin
  Readln(n);
  for i:=1 to n do
  begin
    a[i]:=0;
    o[i]:=0;
  end;

  for i:=1 to n do
  begin
    Read(d);
    for j:=1 to d do
      Inc(a[j]);
  end;

  for i:=1 to n do
    for j:=1 to a[i] do
    begin
      Inc(o[j]);
    end;

  for i:=1 to n do
    Write(o[n-i+1], ' ');
end.

var  n, i, j, tmp: longint;
     a :array[1..110] of longint;
begin
readln(n);
for i := 1 to n do read(a[i]); readln;
for i := 1 to n - 1 do
 for j := i + 1 to n do
   if a[i] > a[j] then begin tmp := a[i]; a[i] := a[j]; a[j] := tmp; end;
for i := 1 to n do write(a[i]); writeln;
end.

var  n, i, j, tmp: longint;
     a :array[1..110] of longint;
begin
readln(n);
for i := 1 to n do readln(a[i]); readln;
for i := 1 to n - 1 do
 for j := i + 1 to n do
   if a[i] > a[j] then begin tmp := a[i]; a[i] := a[j]; a[j] := tmp; end;
for i := 1 to n do write(a[i]); writeln;
end.

var a:array[1..5] of longint; n,i,i1,o:longint;
begin
readln(n);
for i:=1 to n do
  read(a[i]);
for i:=1 to n-1 do
   for i1:=1 to n-i do
       if a[i1]>a[i1+1] then
          begin
             o:=a[i1];
             a[i1]:=a[i1+1];
             a[i1+1]:=o;
          end;
for i:=1 to n do
   write(a[i],' ');
 end.

var a:array[1..5] of longint; i,i1,o:longint;
begin
for i:=1 to 4 do
  read(a[i]);
for i:=1 to 4-1 do
   for i1:=1 to 4-i do
       if a[i1]>a[i1+1] then
          begin
             o:=a[i1];
             a[i1]:=a[i1+1];
             a[i1+1]:=o;
          end;
for i:=1 to 4 do
   write(a[i],' ');
 end.

var
 a:array[1..300,1..300]of char;
 b:array[1..255]of longint;
 i,j,k,n:longint;
 x:char;
procedure ans(x:string);
begin
 writeln(x);
 halt;
end;

begin
 readln(n);
 for i:=1 to n do
 begin
  for j:=1 to n do
  begin
   read(a[i,j]);
   inc(b[ord(a[i,j])]);
  end;
  readln;
 end;
 for i:=1 to 255 do if b[i]<>0 then inc(k);
 if k<>2 then ans('NO');
 x:=a[1,1];
 for i:=1 to n do if (x<>a[i,i])or(x<>a[i,n-i+1]) then ans('NO');
 for i:=1 to n do
  for j:=1 to n do
  begin
   if i=j then continue;
   if j=n-i+1 then continue;
   if x=a[i,j] then ans('NO');
  end;

 ans('YES');
end.

var
 a:array[0..100]of longint;
 i,j,n:longint;
begin
 readln(n);
 for i:=1 to n do readln(a[i]);
 for i:=1 to n do
  for j:=i+1 to n do if a[i]>a[j] then
  begin
   a[0]:=a[i];
   a[i]:=a[j];
   a[j]:=a[0];
  end;
  for i:=1 to n-1 do write(a[i],' ');
  writeln(a[n]);
end.

var
n,i,j,t:integer;
a,k:array[1..100] of integer;
begin
readln(n);
for i:=1 to n do
read(a[i]);
for i:=1 to 100 do
for j:=1 to n do
if a[j]=i
    then inc(k[i]);
for i:=1 to 100 do
if k[i]<>0
   then for j:=1 to k[i] do
            write(i);
end.

var
 i,j,n,m,k,s:longint;
 a:array[-100..100,-100..100] of longint;
begin
 readln(n,m);
 for i:=1 to n do
 begin
  for j:=1 to m do read(a[i,j]);
  readln;
 end;
 for i:=1 to n do
 begin
  s:=0;
  for j:=1 to m do
  begin
   inc(s,a[i,j]);
  end;
  if s>0 then inc(k);
 end;
 writeln(k);
end.

var
  a : array [0..10000] of longint;
 h,i,l,j,n : longint;
begin
  readln(n);
  for i:=1 to n do read(a[i]);
  for h:=1 to n do
   begin
    for i:=n-1 downto 1 do
    if a[i]>=h then
     begin
      l:=n;
      for j:=i+1 to n do
      if (a[j]>=a[i]) or (a[j]<h-1) then begin l:=j-1; break; end;
      dec(a[i]);
      inc(A[l]);
     end;
   end;
  for i:=1 to n do write(a[i],' ');
end.

var
  a : array [0..10000] of longint;
 h,i,l,j,n : longint;
begin
  readln(n);
  for i:=1 to n do read(a[i]);
  for h:=1 to n do
   begin
    for i:=n-1 downto 1 do
    if a[i]>=h then
     begin
      l:=n;
      for j:=i+1 to n do
      if a[j]>=a[i] then begin l:=j-1; break; end;
      dec(a[i]);
      inc(A[l]);
     end;
   end;
  for i:=1 to n do write(a[i],' ');
end.

var
  a : array [0..10000] of longint;
 h,i,l,j,n : longint;
begin
  readln(n);
  for i:=1 to n do read(a[i]);
  for h:=1 to 100 do
   begin
    for i:=n-1 downto 1 do
    if a[i]>=h then
     begin
      l:=n;
      for j:=i+1 to n do
      if (a[j]>=a[i]) then begin l:=j-1; break; end;
      dec(a[i]);
      inc(A[l]);
     end;
   end;
  for i:=1 to n do write(a[i],' ');
end.

var n,i,j,q:integer;a:array[1..100007] of integer;
begin
readln(n);
for i:=1 to n do
read(a[i]);
  for i:=1 to n do
   for j:=i+1 to n do
   if a[i]>a[j] then begin
      q:=a[i]; a[i]:=a[j];a[j]:=q;
      end;
     for i:=1 to n do
     write(a[i]);
     end.

program main;
  var N : LongInt;
      A , Ans : array [ 1 .. 100 ] of LongInt;
	  I , J , Number : LongInt;
begin
  readLn ( N ) ;

  for i := 1 to N do
  begin
    read ( Number ) ;
    for j := Number downto 1 do
	inc ( a [ j ] ) ;
  end;

  for i := 1 to N do
  begin
    for j := N downto (N+1)-a[i] do
	begin
	  inc ( ans [ j ] ) ;
	end;
  end;

  for i := 1 to N do
  begin
    write ( ans [ i ] , ' ') ;
  end;

end.

procedure QSort(arr: array of integer);

    procedure sort(l, r: longint);
    var
      i, j, p, b: longint;
    begin
      if (r - l) > 0 then
      begin
        p := arr[random(r - l + 1) + l];
        i := l;
        j := r;
        while i > j do
        begin
          while arr[i] < p do
            Inc(i);
          while arr[j] > p do
            Dec(j);
          if i < j then
          begin
            b := arr[i];
            arr[i] := arr[j];
            arr[j] := b;
            Inc(i);
            Dec(j);
          end;
        end;
        sort(l,i);
        sort(i+1,r);
      end;
    end;

  begin
    randomize;
    sort(0, high(arr));
  end;

var A:array of integer; i,n:integer;
BEGIN
   read(n);
   setlength(A,n);
   for i:= 0 to n-1 do read(A[i]);
   Qsort(A);
   for i:= 0 to n-1 do write(A[i],' ');
END.

procedure QSort(var A:array of integer);
   procedure sort(l,h:integer);
   var pivot,b,x,y:integer;
   begin
      if l < h then
      begin
         x:=l; y:=h;
         pivot:=A[h];
         while l < h do
         begin
            while A[l] < pivot do inc(l);
            while A[h] > pivot do dec(h);
            if l < h then
            begin
               b:=A[l];
               A[l]:=A[h];
               A[h]:=b;
               inc(l); dec(h);
            end;
         end;
         sort(x,l-1);
         sort(l,y);
      end;
   end;
begin
   sort(0,high(A));
end;
var A:array of integer;n,i:integer;
BEGIN
   read(n);
   SetLength(A,n);
   for i:=0 to n-1 do read(A[i]);
   QSort(A);
   for i:=0 to high(A) do write(A[i],' ');
END.

var a:array[0..101]of byte;
    i,j,b,n:longint;
begin
    readln(n);
    for i:=1 to n do read(a[i]);
    for i:=1 to n-1 do
        for j:=i+1 to n do
            if a[i]>a[j] then
                begin
                    b:=a[i];
                    a[i]:=a[j];
                    a[j]:=a[i];
                end;
    for i:=1 to n do write(a[i],' ');
end.

program gf;
   var a:array[1..100] of byte;
       n,t:byte;
procedure qsort(l,r:byte);
   var i,j,x,tam:byte;
begin
        i:=l;j:=r;
        x:=a[random(r-l+1)+l];
        repeat
                while a[i]<x do inc(i);
                while a[j]>x do dec(j);
                if (i<=j) then
                begin
                        tam:=a[i];
                        a[i]:=a[j];
                        a[j]:=tam;
                        inc(i);
                        dec(j);
                end;
        until i>j;
        if (i<r) then qsort(i,r);
        if (j<l) then qsort(l,j);
end;
begin
        readln(n);
        for t:=1 to n do read(a[t]);
        qsort(1,n);
        for t:=1 to n do write(a[t],' ');
end.

var a:array[1..101]of integer;
n,i,r:integer;
begin
read(n);
for i:=1 to n do
begin
read(a[i]);
end;
for i:=1 to n-1 do
begin
if (a[i]>a[i+1])then begin r:=a[i]; a[i]:=a[i+1];a[i+1]:=r;end;
end;
for i:=1 to n-1 do
begin
if (a[i]>a[i+1])then begin r:=a[i]; a[i]:=a[i+1];a[i+1]:=r;end;
end;
for i:=1 to n do
begin
write(a[i],' ');
end;
end.

var a:array[1..101]of integer;
n,i,r:integer;
begin
read(n);
for i:=1 to n do
begin
read(a[i]);
end;
for i:=1 to n-1 do
begin
if (a[i]>a[i+1])then begin r:=a[i]; a[i]:=a[i+1];a[i+1]:=r;end;
end;
for i:=1 to n do
begin
write(a[i],' ');
end;
end.

var a:array[1..101]of integer;
n,i,r:integer;
begin
read(n);
for i:=1 to n do
begin
read(a[i]);
end;
for i:=1 to n-1 do
begin
if (a[i]>a[i+1])then begin r:=a[i]; a[i]:=a[i+1];a[i+1]:=r;end;
end;
for i:=1 to n do
begin
writeln(a[i]);
end;
end.

Var N, I, J, K, Pr : Integer; A : Array [1..100000] Of Integer;
Begin
Write('Введите количество элементов: '); ReadLn(N);
   For I := 1 To N Do
    Begin
   Readln(A[I]);
    End;
   WriteLn;
   For I := 1 To N - 1 Do
    Begin
     K := I;
     For J := I + 1 To N Do If A[J] <= A[K] Then K := J;
     Pr := A[I]; A[I] := A[K]; A[K] := Pr;
    End;
    For I := 1 To N Do Write(A[I], ' ');
  End.

Var N, I, J, K, Pr : Integer; A : Array [1..100000] Of Integer;
Begin
ReadLn(N);
   For I := 1 To N Do
     Readln(A[I]);
   WriteLn;
   For I := 1 To N - 1 Do
    Begin
     K := I;
     For J := I + 1 To N Do If A[J] <= A[K] Then K := J;
     Pr := A[I]; A[I] := A[K]; A[K] := Pr;
    End;
    For I := 1 To N Do Write(A[I], ' ');
  End.

Var N, I, J, K, Pr : Integer; A : Array [1..100000] Of Integer;
Begin
Write('Введите количество элементов: '); ReadLn(N);
   For I := 1 To N Do
    Begin
     Write('Введите A[', I, '] '); Readln(A[I]);
    End;
   WriteLn;
   For I := 1 To N - 1 Do
    Begin
     K := I;
     For J := I + 1 To N Do If A[J] <= A[K] Then K := J;
     Pr := A[I]; A[I] := A[K]; A[K] := Pr;
    End;
    For I := 1 To N Do Write(A[I], ' ');
  End.

Var a,b:array[1..10000] of longint;
    i,j,k,m,l,o,p,n:longint;

 procedure rec(x:longint);
  begin
   if a[x]>a[x+1] then begin
                        dec(a[x]);
                        inc(a[x+1]);
                        if x<n then rec(x+1);
                       end;
  end;

 Begin
  read(n);
  for i:=1 to n do
   begin
    read(a[i]);
   end;
  for i:=n-1 downto 1 do
   begin
    rec(i);
   end;
  for i:=1 to n do write(a[i],' ');
 ENd.

var
 a: array[1..100] of longint;
 n,b,i,j:longint;
begin
 readln(n);
 for i:=1 to n do
 begin
  read(b);
  inc(a[b]);
 end;
 for i:=1 to n do if a[i]<>0 then write(i,' ');
end.

var
 a: array[1..100] of longint;
 n,b,i,j:longint;
begin
 readln(n);
 for i:=1 to n do
 begin
  read(b);
  inc(a[b]);
 end;
 for i:=1 to n do for j:=1 to a[i] do write(i,' ');
end.

var
 a: array[1..100] of longint;
 n,b,i,j:longint;
begin
 readln(n);
 for i:=1 to n do
 begin
  read(b);
  inc(a[b]);
 end;
 for i:=1 to n do if a[i]<>0 then for j:=1 to a[i] do write(i,' ');
end.

var
 a: array[1..100] of longint;
 n,b,i,j:longint;
begin
 readln(n);
 for i:=1 to n do
 begin
  read(b);
  inc(a[b]);
 end;
 for i:=1 to n do if a[i]<>0 then for j:=1 to a[i] do writeln(i);
end.

var
 a: array[1..100] of longint;
 n,b,i,j:longint;
begin
 readln(n);
 for i:=1 to n do
 begin
  read(b);
  inc(a[b]);
 end;
 for i:=1 to n do if a[i]<>0 then for j:=1 to a[i] do write(i);
end.

var
  a,n,b,c,d,y:longint;
  f,g:array [1..200] of longint;
  x:string[200];

begin
  readln(x);
  d:=length(x);
  for a:=1 to d do
      if a mod 2<>0 then
         begin
           c:=trunc(a div 2) + 1;
           f[c]:=byte(x[a]);
           f[c]:=f[c]-48;
         end;

  n:=trunc(d div 2) + 1;

  for a:=1 to n do
      begin
        for b:=1 to n-1 do
            begin
            if f[b]>f[b+1] then
               begin;
                 g[b]:=f[b];
                 f[b]:=f[b+1];
                 f[b+1]:=g[b];
                 end;
            end;
            end;

  for a:=1 to d do
      begin
      if a mod 2=0 then write(x[a])
      else write(f[trunc(a div 2)+1]);
      end;

  end.

{$MODE OBJFPC}
program column;

const
  inp = '';
  outp = '';
  maxN = Round(1E2+2);

var
  pb,pb2: Text;
  {input}
  n: Integer;
  a: array [0..maxN] of Integer;
  {main}

  {output}

procedure INPUT;
var i: Integer;
begin
  Assign(pb,inp); Reset(pb);
  Assign(pb2,outp); ReWrite(pb2);
  ReadLn(pb,n);
  for i := 1 to n do Read(pb,a[i]);
end;

procedure QS(L,H: Integer);
var i,j: Integer;
    key,t: Integer;
begin
  i := Random(H-L+1)+L;
  key := a[i];
  i := L; j := H;
  while (i<=j) do
  begin
    while (a[i]<key) do Inc(i);
    while (a[j]>key) do Dec(j);
    if (i<=j) then
    begin
      t := a[i]; a[i] := a[j]; a[j] := t;
      Dec(j); Inc(i);
    end;
  end;
  if (L<j) then QS(L,j);
  if (i<H) then QS(i,H);
end;

procedure MAIN;
begin
  QS(1,n);
end;

procedure OUTPUT;
var i: Integer;
begin
  for i := 1 to n do Write(pb2,a[i]);
  Close(pb); Close(pb2);
end;

BEGIN
  INPUT;
  MAIN;
  OUTPUT;
END.

var
  a : array[0..5000] of longint;
  i,j,n,m,k : longint;

begin
  readln(n);
  for i:=1 to n do read(a[i]);
  a[n+1]:=maxlongint;
  for i:=n downto 1 do
    begin
      j:=i;
      while true do begin
        k:=a[i]-a[i+1];
        if k <= 0 then break;
        a[i+1]:=a[i+1]+k;
        a[i]:=a[i]-k;
        inc(j);
      end;
    end;
  for i:=1 to n-1 do write(a[i],' '); writeln(a[n]);
end.

type
  a=array[0..100] of longint;
var
  i,n,j,max,ch,lie:longint;
  mas,tmp,mas1:a;
  s:string;
begin
  readln(n);
  max:=-1;
  for i:=1 to n do
    begin
     read(ch);
     if ch>max then
      max:=ch;
     mas[i]:=ch;
    end;
  for i:=1 to max do
    begin
      ch:=0;
      for j:=1 to max do
        if mas[j]>(i-1) then
          ch:=ch+1;
      mas1[i]:=ch;
    end;
 for i:=n downto 1 do
    begin
      ch:=0;
      for j:=1 to max do
        if mas1[j]>(i-1) then
          ch:=ch+1;
      write(ch, ' ');
    end;
end.

var
mas:array[1..100] of longint;
N,k,i:longint;
Begin
read(N);
for i:=1 to N do
 read(mas[i]);
for i:=1 to N do
 for k:=i to (N - 1) do
  if mas[k] > mas[k + 1] then
   swap(mas[k],mas[k + 1]);
for i:=1 to N do
  write(mas[i],' ');
ENd.

var N, i, j: longint;
    mas: array [1 .. 100] of longint;

begin
  read(N);
  for i := 1 to N do
    read(mas[i]);
  for i := 1 to N - 1 do
    for j := i to N - i do
      if mas[j] < mas[j + 1] then
        swap(mas[j], mas[j + 1]);
  for i := N downto 1 do
    write(mas[i], ' ');
end.

var
  n,i,j,a:integer;
  s:array[1..100] of integer;
begin
  read(n);
  for i :=1 to n do
    read(s[i]);
  for i:=1 to n-1 do
  for j:=i+1 to n do
  begin
    if s[i]>s[j] then
    begin
      a:=s[i];
      s[i]:=s[j];
      s[j]:=a;
    end;
  end;
  for i:=1 to n do
  write(s[i]);
end.

var a: array of integer;
    i, s, j, k: integer;
begin
    readln(s);
    setlength(a, s);
    for i:=0 to s-1 do
        begin
            read(a[i]);
        end;
    for i:=0 to s-1 do
    begin
        for j:=0 to s-2 do
        if a[j]>a[j+1] then
            begin
                k:=a[j+1];
                a[j+1]:=a[j];
                a[j]:=k;
            end;
    end;
    writeln(a);
end.

program grav;
var n,i,count:integer; a:array[1..100]of integer;
begin
readln(n);
for i:=1 to n do
read(a[i]);
for count:=1 to n-1 do
for i:=1 to n-1 do
if a[i]>a[i+1] then
begin
a[i]:=a[i]+a[i+1];
a[i+1]:=a[i]-a[i+1];
a[i]:=a[i]-a[i+1];
end;
for i:=1 to n do
write(a[i]);
end.

var  n,i,j,k:integer;
     a:array[1..100]of integer;
begin
read(n);
for i:=1 to n do read(a[i]);

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

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

Program abc;
     Var n,i,j,k:integer;
     mas:array of integer;
begin
     readln(n);
     Setlength(mas,n+1);
     for i:=1 to n do read(mas[i]);
     for j:=1 to n do
     begin
          for i:=1 to n-1 do
          begin
               if(mas[i]<mas[i+1]) then
               begin
                    k:=mas[i];
                    mas[i]:=mas[i+1];
                    mas[i+1]:=k;
               end;
          end;
     end;
          for i:=1 to n do write(mas[i]);
end.

program enc;
var n,m:integer;
begin
  read(n);
  if (n=1) or (n=3) or (n=6) or (n=12) or (n=15) then
    m:=1
  else
    m:=0;
  write(m);
end.

program cube;
var k,n,d,max,i:integer;
var a:array [1..100] of integer;
begin
  readln(n);
  for d:=1 to n do
  begin
    read(a[d]);
  end;
  for d:=1 to n-1 do
  begin
    k:=d;
    max:=a[d];
    for i:=d+1 to n do
    begin
      if a[i]>max then
      begin
        max:=a[i];
        k:=i;
      end;
      a[k]:=a[d];
      a[d]:=max;
    end;
  end;
  for d:=1 to n do
  begin
    write(a[n-d+1],' ');
  end;
end.

var
  n, i, j, r, max, jj, fl: byte;
  a: array[1..101, 1..101] of byte;

begin
  readln(n);
  for i := 1 to 101 do
    for j := 1 to 101 do a[i, j] := 0;
  max := 0;
  for i := 1 to n do
    begin
      read(r);
      for j := 1 to r do a[j, i] := 1;
      if r > max then max := r
    end;
 { for i := max downto 1 do
    begin
      for j := 1 to n do write(a[i, j]);
      writeln
    end;
  writeln;}

  for i := max downto 1 do
    begin
      for j := n downto 1 do
      begin
        //writeln(i,' ', j);
        if a[i, j] = 1
          then begin

                 for r := j - 1 downto 1 do
                   if a[i, r] <> 0
                     then begin
                            a[i, j] := 0;
                            a[i, r + 1] := 1;
                            break
                          end;
               end end
    end;
    {for i := max downto 1 do
    begin
      for j := 1 to n do write(a[i, j]);
      writeln
    end;}

  for i := n downto 1 do
    begin
      r := 0;
      for j := 1 to max do
        if a[j, i] <> 0 then inc(r);
      write(r,' ')
    end
end.

var a:array[1..100] of integer;
    k,n,i,j:integer;
begin
 read(n);
 for i:=1 to n do
 read(a[i]);
 for i:=1 to n do
  for j:=1 to n-i do
   if a[j]>a[j+1] then begin
                        k:=a[j];
                        a[j]:=a[j+1];
                        a[j+1]:=k;
                       end;
 for i:=1 to n do
  write(a[i]);
end.

var a:array[1..1000] of longint;
    n, i, j, u:longint;
begin

readln(n);

for i:=1 to n do
 read(a[i]);

a[n+1]:=1000;

for i:=n-1 downto 1 do
 if a[i]>a[i+1] then
  begin

   u:=a[i];
   a[i]:=a[i+1];

    for j:=i+1 to n do
    begin
    if a[j+1]>a[j] then begin
                        if u<a[j+1] then a[j]:=u
                                    else begin
                                         a[j]:=a[j+1];
                                         end;
                        end;
    end;

  end;

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

program ideone;
var a:array [1..100] of integer;
    i,j,b,n:integer;
begin
readln(n);
for i:= 1 to n do
 read(a[i]);
for i:= n-1 downto 1 do
 for j:= n downto i do
  if a[i] > a[j] then
   begin
   b:=a[i]-a[j];
   a[j]:=a[j]+b;
   a[i]:=a[i]-b;
   end;
for i:= 1 to n do
 write(a[i]);
end.

program ideone;
var a:array [1..100] of integer;
    i,j,b,n:integer;
begin
readln(n);
for i:= 1 to n do
 readln(a[i]);
for i:= n-1 downto 1 do
 for j:= i to n-1 do
  if a[i] > a[j] then
   begin
   b:=a[i]-a[j];
   a[j]:=a[j]+b;
   a[i]:=a[i]-b;
   end;
for i:= 1 to n do
 write(a[i]);
end.

var
a:array[0..105] of integer;
n,i,x:integer;
begin
readln(n);
read(a[1]);
for i:=2 to n do
  begin
    read(a[i]);
    if a[i]<a[i-1] then
      begin
        x:=a[i-1]-a[i];
        a[i-1]:=a[i];
        a[i]:=a[i]+x;
      end;
    write(a[i-1],' ');
  end;
writeln(a[n]);
end.

var n,i,j,t:integer;
    a:array[1..100]of integer;
begin
readln(n);
for i:=1 to n do
readln(a[i]);
for i:=1 to n do
for j:=n downto i+1 do
if a[i]>a[j] then
begin
t:=a[i]-a[j];
a[i]:=a[i]-t;
a[j]:=a[j]+t;
end;
for i:=1 to n do write(a[i],' ');
readln
end.

var
    a:array[1..101] of longint;
    i,j,t,n:longint;
begin
    readln(n);
    for i:=1 to n do
        read(a[i]);
    for i:=1 to n-1 do
        for j:=i+1 to n do
            if a[i]>a[j] then
            begin
                t:=a[i];
                a[i]:=a[j];
                a[j]:=t;
            end;
    for i:=1 to n do
        write(a[i]);
end.

var i,j,n,o:longint;
	a:array[1..1000000] of longint;
begin
readln(n);
for i:=1 to n do
	read(a[i]);
for i:=1 to n do
	for j:=n downto i+1 do
		if a[i]<a[j] then
			begin
			o:=a[i];
			a[i]:=a[j];
			a[j]:=o;
			end;
for i:=1 to n do
	write(a[i]);
end.

  var x,j,n,i:longint;
      a:array[0..1000] of longint;

begin
read(n,a[1]);
for i:=2 to n do begin
read(x);
j:=i-1;
while a[j]>x do begin
a[j+1]:=a[j]; dec(j);
end;
end;a[j+1]:=x;
 for i:=1 to n do write(a[i],' ');
 { TODO -oUser -cConsole Main : Insert code here }
end.

var i, j, n:integer;
a:array[1..100] of integer;
procedure swap(x, y:integer);
begin
	a[j] := y;
	a[j + 1] := x;
end;
begin
	readln(n);
	for i := 1 to n do read(a[i]);
	for i := 1 to n do
	      for j := 1 to n - 1 do
	            if a[j] < a[j + 1] then swap(a[j], a[j + 1]);
	for i := 1 to n do write(a[i], ' ');
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
type mass=array[1..100]of integer;
var i,n,a,b,j,max:integer; m,k:mass;
begin
{ reset(input,'input.txt');
 }rewrite(output,'output.txt');
 readln(n);
 max:=0;
 for i:=1 to n do
  begin
   read(m[i]);
   if m[i]>max
   then max:=m[i];
  end;

 for i:=1 to max do
  begin
   for j:=1 to n do
    if m[j]>=i
    then inc(k[i]);
  end;
 for i:=n downto 1 do
  begin
   a:=0;
   for j:=1 to max do
    if k[j]>=i
    then inc(a);
   write(a,' ');
  end;
end.