{$DEFINE DMI}
{$DEFINE DO0}
{$DEFINE DEBUG}
{$IFDEF DEBUG}
{$B-,I+,N+,O-,Q+,R+,S+}
{$ELSE}
{$B-,I-,N+,O+,Q-,R-,S-}
{$ENDIF}
{$APPTYPE CONSOLE}
Program OlympSol;
uses SysUtils;
const TaskName = 'heapsort';
 MaxN = 10004;
var i, j, k, l, m,w, n: Integer;
p:array[1..50000] of integer;
BEGIN
 assign (input, TaskName + '.in'); reset (input);
 assign (output, TaskName + '.out'); rewrite (output);
{$IFDEF DMI} repeat {$ENDIF}
 read (n);
 p[1]:=1;
 for k:=2 to n do
 begin
   j:=k-1;
   while j>1 do 
   begin
     w:=p[j];
     p[j]:=p[j shr 1];
     p[j shr 1]:=w;
     j:=j shr 1;
   end;
   p[k]:=k;
   w:=p[k];
   p[k]:=p[1];
   p[1]:=w;
 end;
 for i:=1 to n do
  write(p[i],' ');
{$IFDEF DMI} until seekeof; {$ENDIF}
END.
