#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d>>(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

void comb(vector<vector <long long int> > &v){
  for(int i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(int k = 1;k <v.size();k++){
    for(int j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

vector<vector<long long int> > V(51,vector<long long int>(51,0));
map<ll, pair<ll, vll>> mp;//val -> num


void calc(ll N){
  ll idx = 1;
  vll ans;
  while(N){
    //引ける最も大きいもの
    auto itr = --mp.upper_bound(N);
    ll max_num = (*itr).second.first;
    vll add = (*itr).second.second;
    for(int i=0;i<add.size();i++) ans.push_back(idx + add[i]);
    N -= (*itr).first;
    idx+=max_num;
  }
  std::cout << ans.size() << '\n';
  for(int i=0;i<ans.size();i++) std::cout << ans[i] << (i==ans.size()-1?"\n":" ");
}

ll INF = 1000000000000;
int main(int argc, char const *argv[]) {
  comb(V);

  vll f(101, INF);
  vvvl dp = VVV(101, 101, 101, INF);//2個

  for(ll i=2;i<=100;i++){
    //全部同じ
    ll s = 0;
    for(ll j=2;j<=i;j+=2){
      if(V[i][j] > INF) goto nxt;
      s += V[i][j];
    }
    if(s > INF) break;
    mp.emplace(s, pair<ll, vll>(1, vll(i, 0)));
    f[i] = s;

    if(i>40) continue;

    //2個挟む
    for(int l=0;l<=i;l++){
      for(int r=0;l+r<=i;r++){ //左に何個、右に何個
        ll t = s;
        bool flag = true;
        for(int A=0;A<=l;A++){
          for(int B=0;B<=r&&(i-l-r)>=(A+B);B++){
            if(V[l][A] > INF || V[l][A]*V[r][B]>INF || V[l][A]*V[r][B]*V[i-l-r][A+B] > INF){
              flag = false;
              break;
            }
            t += V[l][A] * V[r][B] * V[i-l-r][A+B];
          }
          if(!flag) break;
        }
        if((t>INF)||(!flag)) continue;
        vll ret(i+2, 0);
        ret[l] = ret[i+1-r] = 1;
        mp.emplace(t, pair<ll, vll>(2, ret));
        dp[i][l][i-r] = t - s;
      }
    }
    //3個
    for(int x=0;x<=i;x++){
      for(int y=x;y<=i;y++){
        for(int z=y;z<=i;z++){
          ll a = dp[i][x][y];
          ll b = dp[i][x][z];
          ll c = dp[i][y][z];
          if(a==INF||b==INF||c==INF) continue;
          ll t = s + a + b + c;
          if(t<INF){
            vll ret(i+3, 0);
            ret[x] = ret[y+1] = ret[z+2] = 1;
            mp.emplace(t, pair<ll, vll>(2, ret));
          }
        }
      }
    }
    //3-2
    for(int a=0;a<=i;a++){
      for(int b=a;b<=i;b++){
        for(int c=b;c<=i;c++){
          for(int d=c;d<=i;d++){
            for(int e=d;e<=i;e++){
              //両方使われる事はない
              ll F = f[i];
              ll L = dp[i][a][b];
              ll R = dp[i][c][d] + dp[i][c][e] + dp[i][d][e];
              if(F==INF||L==INF||R>=INF) continue;
              ll t = F + L + R;
              if(t<INF){
                vll ret(i+5, 0);
                ret[a] = ret[b+1] = 1;
                ret[c+2] = ret[d+3] = ret[e+4] = 2;
                mp.emplace(t, pair<ll, vll>(3, ret));
              }
            }
          }
        }
      }
    }
  }


  nxt:
  /*
  for(auto itr=mp.begin();itr!=mp.end();itr++){
    std::cout << (*itr).first << " " << (*itr).second.first << " " << (*itr).second.second.size() << '\n';
  }
  */

  ll N;std::cin >> N;
  calc(N);
  return 0;
}


Measured memory_bytes: 24540