#define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" using namespace std; #define rep(i, n) for(int i=0; i<(n); ++i) #define FOR(i, m, n) for(int i=(m); i<(n); ++i) #define sz(x) ((int)(x).size()) #define all(x) (x).begin(),(x).end() #define mp make_pair #define pb push_back #define Cout(x) cout << (x) << endl #define Cout2(x, y) cout << (x) << " " << (y) << endl #define dump(x) cout << #x << " = " << (x) << endl; #define forauto(i, a) for(auto i : a)cout << i << " "; puts("") typedef long long LL; typedef vector VI; typedef vector VL; typedef vector VS; typedef vector VB; typedef vector> VVI; typedef pair PII; const int inf = 1e9; const double pi = acos(-1.0); bool Check(int n) { int a = sqrt(n); return a * (a + 1) == n; } int main() { int k; cin >> k; int c0, c1; for (int i = 0; true; i++) { int j = pow(2, i); if (k%j == 0) { int l = k / j; if (Check(l * 2)){ c0 = i; c1 = sqrt(l * 2) + 1; if (c1 + c0 <= 30)break; } } } Cout(c0 + c1); rep(i, c0)cout << "0 "; rep(i, c1)cout << "1" << (i == c1 - 1 ? "" : " "); }