{$DEFINE DEBUG}

{$IFDEF DEBUG}
{$A+,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}
{$ELSE}
{$A+,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}
{$ENDIF}

{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $02000000}
{$APPTYPE CONSOLE}

uses
  Math, SysUtils;

type
  int = longint;
  float = extended;

const
  maxn = 100000;
  cin_file = 'heapsort.in';
  cout_file = 'heapsort.out';
  eps : float = 1e-9;
  fmax : float = 1e40;
  besk = $3F3F3F3F;

var
  n,cnt : int;
  a : array[1..maxn] of int;

procedure swap(var a, b : int);
var
  t : int;
begin
  t := a;
  a := b;
  b := t;
end;

procedure hs;
var
  t,i,j,p,q,x : int;

  procedure sisp;
  begin
    i:=p; j:=i shl 1; x:=a[i];
    if (j < q) and (a[j] <= a[j+1]) then inc(j);
    while (j<=q) and (a[j] > x) do
    begin
      inc(cnt);
      a[i]:=a[j]; i:=j; j:=i shl 1;
      if (j < q) and (a[j] <= a[j+1]) then inc(j);
    end;
    a[i]:=x;
  end;

begin
  q:=n;
  for p:=n downto 1 do sisp;

  a[1]:=6;
  a[2]:=5;
  a[3]:=3;
  a[4]:=4;
  a[5]:=1;
  a[6]:=2;

  cnt:=0;
  p:=1;
  while q > 1 do
  begin
    t:=a[p]; a[p]:=a[q]; a[q]:=t;
    dec(q);
    sisp;
  end;
end;

procedure solve;
var
  i, j, k : int;
begin
  read(n);

  a[1] := 1;
  for i := 2 to n do
  begin
    a[i] := i;
    j := i - 1;
    while (j > 1) do
    begin
      swap(a[j], a[j shr 1]);
      j := j shr 1;
    end;
    swap(a[1], a[i]);
  end; 

  for i:=1 to n do
  begin
    write(a[i]);
    if i < n then write(' ');
  end;
end;

begin
  assign(input, cin_file);
  reset(input);
  assign(output,  cout_file);
  rewrite(output);

  solve;

  close(input);
  close(output);
end.
