#define _CRT_SECURE_NO_WARNiINGS #include <stdio.h> #include <algorithm> #include <utility> #include <functional> #include <cstring> #include <queue> #include <stack> #include <math.h> #include <iterator> #include <vector> #include <string> #include <set> #include <math.h> #include <iostream> #include <random> #include <map> #include <fstream> #include <iomanip> #include <time.h> #include <stdlib.h> #include <list> #include <typeinfo> #include <list> #include <cassert> #include <set> using namespace std; #define eps 0.000000001 #define LONG_INF 10000000000000000 #define GOLD 1.61803398874989484820458 #define MAX_MOD 1000000007 #define REP(i,n) for(long long i = 0;i < n;++i) #define cycle_per_sec 2806192512 int main() { long long k; cin >> k; if (k == 0) { cout << "1" << endl; cout << 1 << endl; return 0; } vector<int> answer; for (int i = 0;true; ++i) { long long top = 40; long long bot = 0; while (top - bot > 1) { long long mid = (top + bot) / 2; long long geko = mid * (mid - 1LL); if (geko/2LL >= k) { top = mid; } else { bot = mid; } } if ((bot) * (bot - 1LL)/2LL == k) { if (answer.size() + bot <= 30) { for (int q = 0; q < bot; ++q) { answer.push_back(1); } break; } } else if (top * (top - 1LL)/2LL == k) { if (answer.size() + top <= 30) { for (int q = 0; q < top; ++q) { answer.push_back(1); } break; } } k /= 2; answer.push_back(0); } cout << answer.size() << endl; for (int i = 0; i < answer.size(); ++i) { cout << answer[i] << " "; } cout << endl; return 0; }