#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{
    ll n; cin >> n;

    ll ans;
    if (n <= 2) {
        ans = 1;
    } else {
        ll c = 0;
        ll i = 1;
        ll sum = 1;
        while (sum <= n + 1) {
            i += 1;
            sum += i;
            c++;
        }
        ans = (n + 1) - c;
    }
    cout << ans << endl;
    return 0;
}
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
using ll = long long;
constexpr int N = 1e6 + 5;

int ed;
ll n;
ll v[200];

void init() {
    v[1] = 1;
    ll b = 0;
    int t = 1;
    for(int i = 2; i <= 200; ++i) {
        v[i] = v[i - 1];
        if(t) {
            b = b + v[i - 1];
        } else {
            v[i] = v[i - 1] + b;
        }
//        printf("%lld\n", v[i]);
        t ^= 1;
        if(b >= 1e18 && v[i] >= 1e18) {
            ed = i;
            break;
        }
    }
}

vector<int> sq;

void dfs(ll res) {
    int tt = upper_bound(v + 1, v + 1 + ed, res) - v - 2;
    sq.emplace_back(tt);
    if(v[tt] != res)  dfs(res - v[tt]);
}

int main() {
    init();
//    for(int i = 1; i <= 10; ++i)  printf("%lld ", v[i]);
    scanf("%lld", &n);
    dfs(n);
//    printf("kk %d\n", (int) sq.size());
    vector<int> ans;
    ans.emplace_back(1);
    int cnt = 1;
    for(int i = 1; i <= sq[0]; ++i) {
        if(i & 1) {
            while(cnt < (int) sq.size() && sq[cnt] == sq[0] - i + 1) {
                ans.emplace_back(1);
                ++cnt;
            }
            if(i != 1)  ans.emplace_back(3);
        } else {
            ans.emplace_back(4);
        }
    }
    printf("%d\n", (int) ans.size());
    for(int num : ans)  printf("%d\n", num);
}