#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <math.h>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define IREP(i,n) for (i = 0; i < (n); i++)

inline bool isLeft(int k)
{
   while (k > 0)
   {
      if (k == 2) return true;
      k /= 2;
   }
   return false;
}

VI r;

void Go(VI v, int vt)
{
   if (v.size() == 0) return;

   r[vt] = v[0];

   if (v.size() == 1) return;

   VI vl,vr;
   for (int i = v.size(); i > 1; i--)
   {
      if (isLeft(i))
      {
         vl.push_back(v[v.size()-i+1]);
      } else
         vr.push_back(v[v.size()-i+1]);
   }

/*   reverse(vl.begin(),vl.end());
   reverse(vr.begin(),vr.end());*/
   Go(vl, vt*2);
   Go(vr, vt*2+1);
}

int main()
{
   ifstream ifs("heapsort.in");
   ofstream ofs("heapsort.out");

   int n;
   ifs >> n;

   VI v;

   int i;
   for (i = n; i > 1; i--) v.push_back(i);

   r.assign(n+1,0);
   if (v.size() > 0) Go(v,1);

   r[n] = 1;

   for (i = 1; i <= n; i++)
   {
      if (i > 1) ofs << " ";
      ofs << r[i];
   }
   ofs << endl;

   return 0;
}