#include #include #include using namespace std; using ll = long long; int main(){ ll k; cin >> k; vector> a(35 , vector(35 , 0)); for(int i = 2; i < 35; i++){ a[i][0] = (ll)i * (i - 1) / 2; } for(int i = 2; i < 35; i++){ for(int j = 1; j < 35; j++){ a[i][j] = a[i][j - 1] * 2LL; } } vector ans; int cnt_0 = 0 , cnt_1 = 0; for(int i = 2; i < 35; i++){ for(int j = 0; j < 35; j++){ if(a[i][j] == k){ cnt_0 = j; cnt_1 = i; //cout << cnt_0 << " : " << cnt_1 << endl; break; } } } cout << cnt_0 + cnt_1 << endl; for(int i = 0; i < cnt_0; i++){ cout << "0" << " "; } for(int i = 0; i < cnt_1; i++){ cout << "1"; if(i != cnt_1 - 1)cout << " "; else cout << endl; } return 0; }