import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int K = scan.nextInt(); scan.close(); if(K == 2) { System.out.println("1 3 2"); System.exit(0); } int a = (int)Math.pow(2, K) - 1; int[]n = new int[a]; n[0] = (int)Math.pow(2,K - 1); int t = 2; int r = 2; int l = 1; int idx = 0; int idx2 = 0; for(int i = 1; i < a; i++) { if(i < r) { if(i == l) { n[i] = n[idx] / 2; idx2 = idx; idx = i; l = l + t; }else { n[i] = n[i - 1] + n[idx2]; } }else if(i == r) { n[i] = n[i - 1] + n[idx2]; t = t * 2; r = r + t; } } int t1 = (int)Math.pow(2, K - 2) - 1; int t2 = (int)Math.pow(2, K - 1) - 1; int t3 = t2 + 1; int b1 = n[t1]; int b2 = n[t2]; int b3 = n[t3]; n[t1] = b3; n[t3] = b1; for(int i = 0; i < a; i++) { if(i == a - 1) { System.out.println(n[i]); }else { System.out.print(n[i] + " "); } } } }