#include using namespace std; using uint = unsigned int; using ll = long long; using pii = pair; #define dbg(x) cerr<<#x": "<<(x)<<'\n' #define dbg_v(x, n) cerr<<#x"[]: ";for(long long _=0;_ gen(int sz, int bit) { if(sz == 0) return vector(); if(sz == 1) return lowerBit = bit, vector{1 << bit}; vector ret; ret = gen(sz / 2, bit - 1); if(sz % 2 == 1) ret.push_back(1 << bit); else ret.push_back((1 << bit) | (1 << lowerBit)); return ret; } int main() { #ifndef ONLINE_JUDGE freopen("data.in", "r", stdin); freopen("data.out", "w", stdout); #endif ios_base::sync_with_stdio(false); int k; cin >> k; if(k == 1) return cout << 1 << '\n' << 1 << '\n', 0; auto v = gen(k, 11); cout << v.size() << '\n'; for(auto el : v) cout << el << ' '; cout << '\n'; return 0; }