#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int k; cin >> k; for (int len = 1; len <= 30; ++len) { for (int zero = 0; zero <= len; ++zero) { int one = len - zero; ll cnt = (1LL << zero) * (one * (one - 1) / 2); if (cnt == k) { cout << len << '\n'; rep(_, zero) cout << "0 "; rep(_, one) cout << "1 "; cout << '\n'; return 0; } } } assert(false); return 0; }