#include using namespace std; typedef long long ll; #define REP(i,n) for(int i=0;i ans; // [x, y] の中で真ん中を取り続ける int dfs(int x, int y) { if(x == y) { ans.push_back(x); return 0; } int num = y - x + 1; if(num % 2 != 0) { int push_num = num / 2 + x; ans.push_back(push_num); dfs(x, push_num - 1); dfs(push_num + 1, y); } else { // 高い方を入れる if(num == 2) { ans.push_back(y); ans.push_back(x); return 0; } else { int push_num = num / 2 + x; ans.push_back(push_num); dfs(x, push_num - 1); dfs(push_num + 1, y); } } return 0; } int main() { cin >> K; // 真ん中 + 1 をとる int root = pow_f(K - 1) + 1; ans.push_back(root); dfs(1, root - 1); if(root + 1 <= pow_f(K) - 1) { dfs(root + 1, pow_f(K) - 1); } REP(i, ans.size()) { printf("%d", ans[i]); if(ans.size() - 1 != i) { printf(" "); } else { printf("\n"); } } return 0; }