#include<bits/stdc++.h>
#define mem(a,x) memset(a,x,sizeof(a))
#define rep(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i <= _##i; ++i)
#define repd(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i >= _##i; --i)
#ifndef ONLINE_JUDGE
#define debug(x...) printf("["#x"]="),print(x);
#else
#define debug(x...) ;
#endif
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fcout cout<<setprecision(4)<<fixed
using namespace std;
typedef long long ll;
//======================================
namespace FastIO{
char print_f[105];void read() {}void print() {putchar('\n');}
template <typename T, typename... T2>
inline void read(T &x, T2 &... oth){x = 0;char ch = getchar();ll f = 1;while (!isdigit(ch)){if (ch == '-')f *= -1;ch = getchar();}while (isdigit(ch)){x = x * 10 + ch - 48;ch = getchar();}x *= f;read(oth...);}
template <typename T, typename... T2>
inline void print(T x, T2... oth){ll p3=-1;if(x<0) putchar('-'),x=-x;do{print_f[++p3] = x%10 + 48;}while(x/=10);while(p3>=0) putchar(print_f[p3--]);if(sizeof...(T2)) putchar(' ');print(oth...);}} // namespace FastIO

using FastIO::print;
using FastIO::read;
//======================================
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn = 1e6+5;

int re[maxn],siz[maxn];
int G[maxn];
int fin(int x){
    return re[x]==x?x:re[x]=fin(re[x]);
}
void merge(int x,int y){
    int fx=fin(x),fy=fin(y);
    if(fx!=fy){
        if(siz[fy]<siz[fx]) swap(fx,fy);
        siz[fy]+=siz[fx];
        G[fy]+=G[fx]+1;
        re[fx]=fy;
    }
    else{
        G[fx]++;
    }
}
int a[maxn],b[maxn];
int main() {
#ifndef ONLINE_JUDGE
    freopen("H:\\code\\in.in", "r", stdin);
    freopen("H:\\code\\out.out", "w", stdout);
    clock_t c1 = clock();
#endif
//**************************************
    rep(i,1,400000) re[i]=i,siz[i]=1;
    int m;
    read(m);
    unordered_set<int>se;
    rep(i,1,m){
        read(a[i],b[i]);
        se.insert(a[i]);
        se.insert(b[i]);
    }
    rep(i,1,m){
        merge(a[i],b[i]);
    }
    int ans=0;
    for(auto v:se){
        if(v==fin(v)){
            if(G[v]==siz[v]-1){
                ans+=G[v];
            }
            else ans+=siz[v];
        }
    }
    print(ans);
//**************************************
    
#ifndef ONLINE_JUDGE
    cerr << "Time:" << clock() - c1 << "ms" << endl;
#endif
    return 0;
}

#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define int long long
using namespace __gnu_pbds;
using namespace std;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int f[100];

signed main()
{
	ios::sync_with_stdio(false);
	f[0]=1;f[1]=1;
	int cnt=0;
	for(int i=2;;i++){
		f[i]=f[i-1]+f[i-2];
		if(f[i]>(int)1e18){
			cnt=i-1;break;
		}
	}
	int n;cin>>n;
	vector<int> v,ans;
	int pos=0,p=n;
	for(int i=cnt;i>=1;i--){
		if(p>=f[i]){
			p-=f[i];
			v.push_back(i);
		}
	}
	pos=v[0];
	ans.push_back(1);
	int now=0;
	for(int i=1;i<=pos;i++){
		if(i%2==0||i==pos) ans.push_back(3);
		else ans.push_back(4);
		if(now<v.size()-1&&i==pos-v[now+1]){
			if(i%2==0) ans.push_back(1);
			else ans.push_back(2);
			now++; 
		}
	}
	cout<<ans.size()<<endl;
	for(int i=0;i<ans.size();i++) cout<<ans[i]<<endl;
	int x=0,y=0;
	for(int i=0;i<ans.size();i++){
		if(ans[i]==1) x++;
		else if(ans[i]==2) y++;
		else if(ans[i]==3) x=x+y;
		else if(ans[i]==4) y=x+y; 
	}
	assert(x==n);
	return 0;
}