#include <iostream>
#include <vector>
#include <cstring>
#include <bits/stdc++.h>
#define IOS ios:: sync_with_stdio(false), cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vii vector<int>
#define vll vector<ll>
#define sll set<ll>
#define vvll vector<vll>
#define vpll vector<pll>
#define vpii vector<pii>
#define all(V)  V.begin(),V.end()
#define allr(A) V.rbegin(),V.rend()
#define ff first
#define ss second
#define forz(i,n) for(int i=0;i<n;i++)
#define fora(i,a,n) for(int i=a;i<n;i++)
#define mod 1000000007

using namespace std;

vector < ll > fib(100,0);

void precalculate(){
	fib[0] = fib[1] = 1;
	fora(i,2,90){
		fib[i] = fib[i-1] + fib[i-2];
		//cout<<" i:"<<i<<" fib:"<<fib[i]<<" ";
	}
	//fib[87]>10^18
}
int main()
{
	IOS
	ll N,n,i=86,imx = 0;
	cin>>N;
	vector < int > v,ind;
	n = N;
	if(n==1){cout<<"1\n1\n";return 0;}
	else if(n==2){cout<<"2\n1\n1\n";return 0;}
	precalculate();
	/*v.pb(1);
	v.pb(2);
	while(n && i>=0){
		if(n>=fib[i]){n-=fib[i];ind.pb(i);imx = max(imx,i);i-=2;cout<<"check n:"<<n<<" i:"<<i<<endl;}
		else i--;
		//cout<<" n:"<<n<<endl;
	}
	int total = imx + ind.size(),j=0;
	cout<<total<<"\n1\n2\n";
	for( int i = 0; i<=imx; i++){
		if(j<ind.size() && imx-i==ind[j])cout<<(ind[j]%2?"2\n":"1\n");
		if(imax%2)cout<<(i%2?"3\n":"4\n");
		else if(imax%2==0)cout<<(i%2?"4\n":"3\n");
	}*/
	int f[100] = {}, maxi = 0;
	for (int i = 88; i >= 0; i--) {
		if (N >= fib[i]) {
			f[i] = 1;
			N -= fib[i];
			if (maxi == 0) maxi = i;
		}
	}
	vector<int> ans;
 
	for (int i = maxi; i >= 1; i--) {
		if (f[i]) ans.pb(1 + (i % 2));
		ans.pb(4 - (i % 2));
	}
	cout<<ans.size()<<endl;
	for(auto q:ans)cout<<q<<" ";
	cout<<endl;
		
return 0;
}

#include<bits/stdc++.h>

using namespace std;
using   ll = long long;
using   ld = long double;

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define pb                  push_back
#define mp                  make_pair
#define F                   first
#define S                   second
#define pll                 pair<int , int>
#define int                 long long int
#define endl                "\n"


#define ALL(v)              v.begin(),v.end()
#define ALLR(v)             v.rbegin(),v.rend()
#define pii                 3.14159265358979323
#define inf                 LLONG_MAX
#define ones(x)             __builtin_popcount(x)
#define fill(a,b)           memset(a,b,sizeof(a))
#define mod                 1000000007
#define hell                998244353

ll mod_pow(ll a,ll b,ll m)
{
    ll res = 1;
    while(b)
    {
        if(b&1)
        {
                res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(int a , int m)
{
        return mod_pow(a , m - 2 , m);
}

void solve()
{
        ll n;
        cin >> n;
        ll ans = 0;
        for(ll i=1;i<=1e6;i++)
        {
                ll len = to_string(i).length();
                ll j = i + i*pow(10,len);
                if(j <= n)
                        ans++;
                else
                        break;
        }
        cout << ans;
}

signed main() {
        fast;
   
        int t = 1;
        
        //cin >> t;
        
        int cur = 1;

        while(t--) {
                // cout << "Case #" << cur++ << ": ";
                solve();
        }
        
        return 0;
}