#include <bits/stdc++.h>
using namespace std;

int k, m, root, l, r, cnt = 1, u;
bool used[100000];

void dfs(int left, int right) {
    if (cnt > u) return;
    if (left == right) return;
    if (right - left == 1) {
        if (left != 0 and !used[left] and !used[right]) {
            cout << left << " " << right << (cnt == u-1 ? "\n" : " ");
            cnt++;
        }
        else if (!used[right]) {
            cout << right << (cnt == u ? "\n" : " ");
            cnt++;
        }
        else if (left != 0 and !used[left]) {
            cout << left << (cnt == u ? "\n" : " ");
            cnt++;
        }
        used[left] = used[right] = true;
        return;
    }
    if (!used[(left + right) / 2]) {
        cout << (left + right) / 2 << (cnt == u ? "\n" : " ");
        cnt++;
    }
    used[(left + right) / 2] = true;
    dfs(left, (left + right) / 2);
    dfs((left + right) / 2 + 1, right);
}

int main() {
    cin >> k;
    u = pow(2, k) - 1;
    if (k == 2) {
        cout << 1 << " " << 2 << " " << 3 << endl;
        return 0;
    }
    else { 
        dfs(0, u);
    }

    return 0;
}