import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; import java.util.TreeSet; public class Main { public static void dfs(int begin, int last, StringBuilder sb){ final int size = (last - begin) + 1; if(size <= 0){ return; } final int curr = begin + size / 2; //System.out.println(size + " : " + begin + ", " + last + " : " + curr); sb.append(" " + (begin + size / 2)); if(size >= 2){ dfs(begin, begin + size / 2 - 1, sb); dfs(begin + size / 2 + 1, last, sb); return; } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int K = sc.nextInt(); final int limit = (1 << K) - 1; final int first = limit / 2 + 2; StringBuilder sb = new StringBuilder(); sb.append(first); //System.out.println(1 + " " + first + " " + limit); dfs(1, first - 1, sb); if(first < limit){ dfs(first + 1, limit, sb); } System.out.println(sb.toString()); } }