#include using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef long double ld; typedef pair P; int main() { int k; cin >> k; vector res; auto dfs = [&](auto& f, int l, int r)->void{ if (l > r) return ; if (l == r) { res.emplace_back(l); return ; } int m = (l + r) / 2; res.emplace_back(m); f(f, l, m - 1); f(f, m + 1, r); }; dfs(dfs, 1, (1 << k) - 2); cout << (1 << k) - 1 << " "; for (auto e : res) cout << e << " "; cout << endl; return 0; }