#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; vector A; vector done; string ans = ""; void dfs( int l, int c, int r ) { if ( done[c] ) { return; } done[c] = 1; ans += to_string( A[c] ) + " "; dfs( l,(l+c)/2, c ); dfs( c,(r+c)/2, r ); } int main() { int K; cin >> K; int N = pow(2,K)-2; A.resize(N); done.resize(N+1); for ( int i = 0; i < N; i++ ) { A[i] = i+1; done[i+1] = 0; } dfs( 0, N/2, N ); cout << N+1 << " " << ans.erase( ans.length()-1, 1 ) << endl; return 0; }