/** * @FileName a.cpp * @Author kanpurin * @Created 2022.03.13 10:28:42 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; ll f(ll x) { int c = 0; while(x > 1) { c++; x >>= 1; } for (int i = 0; i < c; i++) { x <<= 1; } return x; } int main() { ll n;cin >> n; if (n == 0) { cout << -1 << endl; return 0; } vector ans; while(n>0) { ll x = f(n); n = n^(2*x-1); ans.push_back(x); } cout << ans.size() << endl; for (int i = 0; i < ans.size(); i++) { cout << ans[i] << " "; } cout << endl; return 0; }