import math def divisor(n): L, R = [1], [n] last = math.floor(n ** 0.5) for i in range(2, last + 1): if n % i == 0: L.append(i) if i != n // i: R.append(n // i) return sum(L + R[::-1]) N = int(input()) if N == 0: print(-1) exit() a = [] while N > 7: b = N - 1 while True: x = divisor(b) if len(bin(x)) == len(bin(N)): break b -= 1 a.append(b) N ^= x if N >= 4: a.append(3) N ^= 4 if N == 1: a.append(1) elif N == 2: a.append(2) a.append(1) elif N == 3: a.append(2) print(len(a)) print(*a)