#include <iostream> using namespace std; int n,tot=0,ans[101]; int main() { cin >> n; while (n > 1) { n=n-(n>>1); ans[++tot]=n; } cout << tot << endl; for (int i=1;i<=tot;++i) cout << ans[i] << ' '; return 0; } //by zzy