#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define SZ(x) ((int)(x).size())
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) \
  SORT(var);       \
  REVERSE(var)
#define OPTIMIZE_STDIO         \
  ios::sync_with_stdio(false); \
  cin.tie(0);                  \
  cout.precision(10);          \
  cout << fixed
#define endl '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

void solve(istream& cin, ostream& cout) {
  int n;
  cin >> n;
  vector<ll> a(n);
  REP(i, n) cin >> a[i];
  vector<ll> c(n + 1);
  c[0] = 0;
  REP(i, n) {
    if (i % 2 == 0) c[i + 1] = c[i] + a[i];
    else
      c[i + 1] = c[i] - a[i];
  }
  map<ll, ll> mp;
  FOR(i, 0, n) mp[c[i]]++;
  ll ans = 0;
  EACH(e, mp) {
    ans += e.second * (e.second - 1) / 2;
  }
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    v fib(88,0);
    fib[0]=1;fib[1]=1;
    rep(i,2,88)fib[i]=fib[i-1]+fib[i-2];

    ll N;
    cin>>N;
    v fbit(88,0);
    ll sbit;
    bool ok = false;
    for(ll i = 87;i>=0;i--){
        if(N>=fib[i]){
            fbit[i]=1;
            N-=fib[i];
            if(!ok){
                sbit = i;
                ok = true;
            }
        }
    }
    ll nowxy = sbit%2;
    ll x=0,y=0;
    ll sb=0;
    rep(i,0,sbit+1){
        if(fbit[i]==1)sb++;
    }

    cout<<sb+sbit<<endl;
    for(ll i = sbit; i>=1;i--){
        if(fbit[i]){
            cout<<nowxy+1<<endl;
            if(nowxy==0)x++;
            else y++;
        }
        nowxy++;nowxy%=2;
        cout<<nowxy+3<<endl;
        if(nowxy==0)x=x+y;
        else y=x+y;
    }
    //cout<<x<<" "<<y;
    return 0;
}