def dfs(l,r) mid = (r + l) / 2 r - l <= 2 ? (l ... r).to_a : [mid, dfs(l, mid), dfs(mid + 1, r)] end puts [1, 2, dfs(3, 1 << gets.to_i)].flatten * ' '