#include #include #include #include #include #include #include #include #include static const int MOD = 1000000007; using ll = int64_t; using u32 = uint32_t; using namespace std; template constexpr T INF = ::numeric_limits::max()/32*15+208; int main() { ll k; cin >> k; ll x = 1; for (int i = 0; i <= 30; ++i) { // 0 for (int j = 1; i+j <= 30; ++j) { // 1 ll y = x*j*(j-1)/2; if(y == k){ cout << i+j << "\n"; for (int l = 0; l < i; ++l) cout << 0 << " "; for (int l = 0; l < j; ++l) cout << 1 << " "; cout << "\n"; return 0; } } x *= 2; } return 0; }