#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cctype>
#include <cmath>
#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <stack>
#include <queue>
#include <ctime>
#include <cassert>
#define _for(i,a,b) for(int i=(a);i<(b);++i)
#define _rep(i,a,b) for(int i=(a);i<=(b);++i)
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
inline int read_int(){
    int t=0;bool sign=false;char c=getchar();
    while(!isdigit(c)){sign|=c=='-';c=getchar();}
    while(isdigit(c)){t=(t<<1)+(t<<3)+(c&15);c=getchar();}
    return sign?-t:t;
}
inline LL read_LL(){
    LL t=0;bool sign=false;char c=getchar();
    while(!isdigit(c)){sign|=c=='-';c=getchar();}
    while(isdigit(c)){t=(t<<1)+(t<<3)+(c&15);c=getchar();}
    return sign?-t:t;
}
inline char get_char(){
    char c=getchar();
    while(c==' '||c=='\n'||c=='\r')c=getchar();
    return c;
}
inline void write(LL x){
    char c[21],len=0;
    if(!x)return putchar('0'),void();
    if(x<0)x=-x,putchar('-');
    while(x)c[++len]=x%10,x/=10;
    while(len)putchar(c[len--]+48);
}
inline void space(LL x){write(x),putchar(' ');}
inline void enter(LL x){write(x),putchar('\n');}
LL cal(LL n,LL p){
	int pos=3;
	LL ans=0;
	while(p>0){
		LL t=n;
		while(t>=p){
			t-=p;
			ans++;
		}
		if(pos==3)pos=4;
		else pos=3;
		n=p;
		p=t;
	}
	return ans+n;
}
int main()
{
//	freopen("test.in","r",stdin);
//	freopen("test.out","w",stdout);
	LL n=read_LL();
	LL v=n*2/(sqrt(5)+1);
	for(LL i=max(v-20,0LL);i<=min(v+20,n);i++){
		if(cal(n,i)<125){
			LL p=i;
			stack<int> s;
			int pos=3;
			while(p>0){
				LL t=n;
				while(t>=p){
					t-=p;
					s.push(pos);
				}
				if(pos==3)pos=4;
				else pos=3;
				n=p;
				p=t;
			}
			enter(s.size()+n);
			LL tn=0,tp=0;
			_for(i,0,n){
				if(pos==3){
					tn++;
				}
				else
				tp++;
				enter(pos-2);
			}
			while(!s.empty()){
				enter(s.top());
				if(s.top()==3)
				tn=tn+tp;
				else
				tp=tn+tp;
				s.pop();
			}
			return 0;
		}
	}
	return 0;
}
#include<bits/stdc++.h>

#define st first
#define nd second
#define pb(x) push_back(x)
#define pp(x) pop_back(x)
#define mp(a, b) make_pair(a, b)
#define all(x) (x).begin(), (x).end()
#define rev(x) reverse(all(x))
#define sor(x) sort(all(x))
#define sz(x) (int)(x).size()
#define rsz(x) resize(x)

using namespace std;

///~~~~~~~~~~~~~~~~~~~~~~~~~~

void debug(){cerr<<"\n";}
template <typename H, typename... T>
void debug(H h, T... t) {cerr<<h; if (sizeof...(t)) cerr << ", "; debug(t...);}
#define deb(x...) cerr<<#x<<" = ";debug(x);

///~~~~~~~~~~~~~~~~~~~~~~~~~

typedef __int128 ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii > vii;
typedef vector<ll> vl;
typedef vector<pll> vll;
typedef string str;

#define BOOST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

//mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

const int N=1e3+5, mod=1e9+7, INF=1e9+5;
int dp[N][N], par[N][N];
vector<int> solve(ll x, ll y){
	vector<int> V;
	while((x>=N || y>=N) && x>0 && y>0){
		if(x>y){
			/*while(5*y*y<(2*x-y)*(2*x-y)){
				V.pb(1);
				x--;
			}*/
			if(x>=y){
				x-=y;
				V.pb(3);
			}
		}
		else{
			/*while(5*x*x<(2*y-x)*(2*y-x)){
				V.pb(2);
				y--;
			}*/
			if(y>=x){
				y-=x;
				V.pb(4);
			}
		}
		if(V.size()>1000)return vi(1000);
	}
	if(x>=N || y>=N)return vi(1000);
		while(x || y){
			V.pb(par[x][y]);
			if(par[x][y]==1)x--;
			else if(par[x][y]==2)y--;
			else if(par[x][y]==3)x-=y;
			else y-=x;
			if(V.size()>1000)return vi(1000);
		}
	return V;
}
int main(){
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			dp[i][j]=mod;
		}
	}
	dp[0][0]=0;
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			if(i>0 && dp[i][j]>dp[i-1][j]){
				par[i][j]=1;
				dp[i][j]=dp[i-1][j]+1;
			}
			if(j>0 && dp[i][j]>dp[i][j-1]){
				par[i][j]=2;
				dp[i][j]=dp[i][j-1]+1;
			}
			if(i>=j && dp[i][j]>dp[i-j][j]){
				par[i][j]=3;
				dp[i][j]=dp[i-j][j]+1;
			}
			if(i<=j && dp[i][j]>dp[i][j-i]){
				par[i][j]=4;
				dp[i][j]=dp[i][j-i]+1;
			}
		}
	}
	//BOOST;
	long long n;
	cin>>n;
	ld phi=1.618033988749894848204586;
	ll x=n, y=n/phi;
	while(5*y*y<(2*x-y)*(2*x-y)){
		y++;
	}
	while(5*y*y>=(2*x-y)*(2*x-y)){
		y--;
	}
	vector<int> opt(1000);
	y+=50;
	for(int i=0; i<100 && i<=y; i++){
		vi V=solve(x, y-i);
		if(V.size()<opt.size())opt=V;
	}
	rev(opt);
	cout<<opt.size()<<"\n";
	for(int i:opt)cout<<i<<"\n";
}
