#include <bits/stdc++.h>
using namespace std;
 
using ll = long long int;
using ull = unsigned long long int;
using P = pair<ll, ll>;
using P3 = pair<int,P>;
using PP = pair<P, P>;
constexpr int INF32 = 1 << 30;
constexpr ll INF64 = 1LL << 60;
constexpr ll MOD = 1000000007;
// constexpr ll MOD = 998244353;
constexpr int di[] = {0, 1, 0, -1};
constexpr int dj[] = {1, 0, -1, 0};
constexpr int di8[] = {0, 1, 1, 1, 0, -1, -1, -1};
constexpr int dj8[] = {1, 1, 0, -1, -1, -1, 0, 1};
constexpr double EPS = 1e-10;
const double PI = acos(-1);
 
#define ALL(v) (v).begin(),(v).end()
#define REP(i,n) for(int i=0,i_len=n; i<i_len; ++i)
 
template<typename T1,typename T2> bool chmax(T1 &a, T2 b) { if (a<b) { a=b; return 1; } return 0; }
template<typename T1,typename T2> bool chmin(T1 &a, T2 b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    ll n;
    cin >> n;
    vector<ll> fibo = {1,1};
    while(fibo.back() < n){
        int k = fibo.size();
        fibo.push_back(fibo[k-1]+fibo[k-2]);
    }
    int m = fibo.size()-1;
    vector<int> v;
    for(ll i = m-1, s=n; s > 0 && i >= 0; i--){
        while(s >= fibo[i]){
            v.push_back(m-i-1);
            s -= fibo[i];
        }
    }
    // for(auto x : v){
    //     cout << x << " ";
    // }
    // cout << endl;
    v.push_back(INF32);
    ll x = 0, y = 0;
    vector<int> ans;
    for(int i=0,j=0;x<n;i++){
        while(v[j]==i){
            if(i%2==0){
                y++;
                ans.push_back(1);
            }else{
                x++;
                ans.push_back(0);
            }
            j++;
        }
        if(i%2==0){
            x = x+y;
            ans.push_back(2);
        }else{
            y = x+y;
            ans.push_back(3);
        }
    }
    cout << ans.size() << endl;
    int f = (x==n ? 0 : 1);
    for(auto t : ans){
        cout << (t^f)+1 << endl;
    }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double

ld rr = 1.618033988;
vector<int> ans, ans_tmp;

ll last = -1;
int flag = -1;
ll cnt_tmp = 1e18;

void func(ll x, ll y) {
    if (x == 0) {
        last = y;
        flag = 0;
        for (ll i=0;i<y;i++) {
            ans_tmp.push_back(2);
        }
    } else if (y == 0) {
        last = x;
        flag = 1;
        for (ll i=0;i<x;i++) {
            ans_tmp.push_back(1);
        }
    } else if (x <= y) {
        ans_tmp.push_back(4);
        func(x, y-x);
    } else if (x > y) {
        ans_tmp.push_back(3);
        func(x-y, y);
    }
    return;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll N;
    cin >> N;

    ll M = (ll)((ld)N/(rr+1.0));

    for (ll j=0;j<1e2;j++) {
        if (0 <= M-j && M-j <= N) {
            last = -1;
            flag = -1;
            ans_tmp.clear();
            func(N, M-j);
            if (ans_tmp.size() < cnt_tmp) {
                ans = ans_tmp;
                cnt_tmp = ans.size();
                // break;
            }
        }

        
        if (0 <= M+j && M+j <= N) {
            last = -1;
            flag = -1;
            ans_tmp.clear();
            func(N, M+j);
            if (ans_tmp.size() < cnt_tmp) {
                ans = ans_tmp;
                cnt_tmp = ans.size();
                // break;
            }
        }
    }

    reverse(ans.begin(), ans.end());
    cout << ans.size() << "\n";
    for (auto ele : ans) {
        cout << ele << "\n";
    }
    return 0;
}

// 1000000000000000000
// 999999999999999999
