#include<bits/stdc++.h>
#include<iostream>
#include<map>
#include<math.h>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#define _GLIBCXX_DEBUG
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
using namespace std;
using ll=long long;
const ll INF=50000000000000000;
const ll dx[8]={1,0,-1,0,1,1,-1,-1};
const ll dy[8]={0,1,0,-1,1,-1,1,-1};
ll mod(ll x,ll m){return x & m;}
ll modinv(ll a,ll m){ll b=m,u=1,v=0;while(b){ll t=a/b;a-=t*b;swap(a,b);u-=t*v;swap(u,v);}u%=m;if(u<0){u+=m;}return u;}
ll modpow(ll a,ll n,ll m){ll res=1;while(n>0){if(n&1){res=res*a%m;}a=a*a%m;n>>=1;}return res;}
ll npow(ll a,ll n){ll res=1;while(n>0){if(n&1){res=res*a;}a=a*a;n>>=1;}return res;}
ll yaku(ll x){ll cnt=0;for(int i=1;i*i<=x;i++){if(x%i==0){if(i==x/i){cnt++;}else{cnt+=2;}}}return cnt;}
ll modwaru(ll a, ll b, ll m){a%=m;return a*modinv(b,m)%m;}
ll gcd(ll x, ll y){if(x%y==0){return y;}else{return gcd(y, x % y);}}
struct UnionFind{vector<ll>par;UnionFind(ll N):par(N){for(ll i=0;i<N;i++)par[i]=i;}ll root(ll x){if(par[x]==x){return x;}return par[x]=root(par[x]);}void unite(ll x,ll y){ ll rx=root(x);ll ry=root(y);if(rx==ry){return;}par[rx]=ry;}bool same(ll x,ll y){ll rx=root(x);ll ry=root(y);return rx==ry;}};

int main(){
    ll N, ans = 0;
    cin >> N;
    vector<ll> A(N), rui(N + 1, 0);
    for(int i = 0; i < N; i++) cin >> A[i];
    rui[0] = 0;
    for(int i = 1; i <= N; i++){
        if(i % 2 == 1) rui[i] += rui[i - 1] + A[i - 1];
        else rui[i] += rui[i - 1] - A[i - 1];
    }
    map<ll,ll> cnt;
    for(int i = 0; i <= N; i++){
        cnt[rui[i]]++;
    }
    for(pair<ll,ll> a : cnt){
        ans += a.second * (a.second - 1) / 2;
    }
    cout << ans << endl;
}
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;

#define REP(i,b,e) for(int i=b; i<e; i++)
#define PRINT(vec) {printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");}
#define fi first
#define se second

const int MOD = 1e9+7;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	ll n;
	scanf("%ld", &n);
	ll a[n];
	REP(i, 0, n) scanf("%ld", &a[i]);

	ll waO[1+n] = {}, waE[1+n] = {};
	REP(i, 0, n){
		if(i%2) waO[i+1] += a[i];
		else waE[i+1] += a[i];
		waO[i+1] += waO[i];
		waE[i+1] += waE[i];
	}

	std::map<ll, ll> mp;
	REP(i, 0, n+1) mp[waO[i] - waE[i]]++;
	ll ans = 0;
	for(auto [k,v]: mp){
		ans += v * (v-1) / 2;
	}
	printf("%ld\n", ans);
	return 0;
}

