/* Author: rrrr_wys
 **/

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
typedef double db;
typedef long long ll;
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;

const int N = 200100;
const int P = 1e9 + 7;

ll n, f[1223][1222];
int nn[222], vis[N];
vector<int> op;
void op1() { op.pb(1); }
void op2() { op.pb(2); }
void op3() { op.pb(3); }
void op4() { op.pb(4); }
vector<vector<int>> ops;

int mn = 200;
vector<pii> vv, v;
void dfs(ll n, int num, int I) {
  if (n == 0) {
    if (mn > num) {
      mn = num;
      v = vv;
    }
    return;
  }
  if (num > mn)
    return;
  rep(k, 1, 1) {
    per(i, min(nn[k], I), 2) {
      if (f[k][i] <= n) {
        vv.pb({k, i});
        dfs(n - f[k][i], num + k, i);
        vv.pop_back();
        break;
      }
    }
  }
}
signed main() {
  cin >> n;
  ll tn = n;

  rep(k, 1, 130) {
    f[k][1] = 0;
    f[k][2] = k;
    for (int i = 3;; ++i) {
      f[k][i] = f[k][i - 1] + f[k][i - 2];
      if (f[k][i] >= n) {
        nn[k] = i;
        break;
      }
    }
  }

  // rep(k, 1, 130) {
  //  per(i, nn[k], 2) if (f[k][i] <= n) {
  //    vv.pb({k, i});
  //    dfs(n - f[k][i], k + i - 2, i);
  //    vv.pop_back();
  //  }
  //}
  // cout << mn << "\n";
  // for (auto vx : v) {
  //  cout << vx.fi << "," << vx.se << "\n";
  //}

  int ff = 0;
  per(i, nn[1], 2) if (f[1][i] <= n) {
    if (!ff) {
      ff = 1;
      if (i & 1) {
        op2();
        rep(k, 3, i) {
          if (k & 1)
            op3();
          else
            op4();
        }
      } else {
        op1();
        rep(k, 3, i) {
          if (k & 1)
            op4();
          else
            op3();
        }
      }
    } else {
      int pp = op.size() - i + 1;
      if (i & 1)
        vis[pp] = 2;
      else
        vis[pp] = 1;
    }
    n -= f[1][i];
  }
  vector<int> ans;
  rep(i, 0, (int)op.size() - 1) {
    ans.pb(op[i]);
    if (vis[i])
      ans.pb(vis[i]);
  }
  assert(ans.size() <= 130);
  ll x = 0, y = 0;
  cout << ans.size() << "\n";
  for (int w : ans) {
    cout << w << "\n";
    switch (w) {
    case 1:
      x++;
      break;
    case 2:
      y++;
      break;
    case 3:
      x += y;
      break;
    case 4:
      y += x;
      break;
    }
  }
  assert(x == tn);
}
#include <bits/stdc++.h>
#define int long long
using namespace std;

inline int read(){
    int s=0,w=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')w=-1;ch=getchar();
    }
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    return s*w;
}

inline bool read(int& a){
    int s=0,w=1;
    char ch=getchar();
    if(ch==EOF){
        return false;
    }
    while(ch<'0'||ch>'9'){
        if(ch=='-')w=-1;ch=getchar();
    }
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    a=s*w;
    return true;
}

inline void write(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}

inline void writeln(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
    puts("");
}

int n;
int ans;

signed main(){
    n=read();

    for(int i=1;i*i<=n;i++){
        if(n%i==0&&i*i!=n){
            int j=n/i;
            if(i%2==1) ans++;
            if(j%2==1) ans++;
        }
        else if(i*i==n){
            if(i%2==1) ans++;
        }
    }

    n*=2;

    for(int i=1;i*i<=n;i++){
        if(n%i==0&&i*i!=n){
            int j=n/i;
            if(i%2==0&&j%2==1) ans++;
            if(j%2==0&&i%2==1) ans++;
        }
        else if(i*i==n){
            continue;
        }
    }

    writeln(ans);

    return 0;
}