using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = long.Parse(ReadLine()); if (n == 0) { WriteLine(-1); return; } var ans = new List(); for (var i = 40; i >= 0; --i) { if ((n ^ ((1L << i + 1) - 1)) < n) { n ^= (1L << i + 1) - 1; ans.Add(1L << i); } } WriteLine(ans.Count); WriteLine(string.Join(" ", ans)); } }