#include <iostream>
#include <vector>

int main() {
    freopen("notation.in", "r", stdin);
    freopen("notation.out", "w", stdout);

    long long x;
    std::cin >> x;

    std::vector <int> res;
    while (x) {
        res.push_back(x & 1);
        (x -= res.back()) /= -2;
    }
    if (res.empty()) {
        res.push_back(0);
    }
    std::cout << int(res.size()) << "\n";
    for (int i = 0; i < int(res.size()); ++i) {
        std::cout << res[i] << " ";
    }
    std::cout << std::endl;
    return 0;
}