n = int(input()) if n == 0: print(-1) exit() D = [-1 for _ in range(50)] for i in range(50): D[i] = n % 2 n //= 2 if n == 0: break ANS = [] for i in range(49): if D[i] == -1: break if D[i + 1] != D[i]: ANS.append(pow(2, i)) print(len(ANS)) print(*ANS)