#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
// typedef vector<pair<int,int>> vpii;
// typedef vector<vector<int>> vvi;
// typedef vector<vector<char>> vvc;
// typedef vector<vector<string>> vvs;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repll(i, n) for (long long int i = 0; i < n; i++)
#define fin(ans) cout << (ans) << endl
#define P 1000000007
#define STI(s) atoi(s.c_str())  // string to int
#define mp(p, q) make_pair(p, q)
#define Sort(a) sort(a.begin(), a.end())
template <class T>
inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const int INF = INT_MAX;
const long long LLINF = 1LL << 60;
template <typename T_char>
char ToUpper(char cX) {
    return toupper(cX);
}
// g++ -std=c++1z temp.cpp
//./a.exe
ll digit(ll a) {
    ll count = 0;
    for (ll i = 0; i < a; i++) {
        if (a == 0) {
            break;
        } else {
            a = a / 10;
            count++;
        }
    }
    return count;
}

uintmax_t comb(unsigned int n, unsigned int r) {
    if (r * 2 > n) r = n - r;
    uintmax_t dividend = 1;
    uintmax_t divisor = 1;
    for (unsigned int i = 1; i <= r; ++i) {
        dividend *= (n - i + 1);
        divisor *= i;
    }
    return dividend / divisor;
}
//桁数のカウント
// pow(x,n) == x^n
// sum = accumulate(v.begin(),v.end(),0);
// using Graph = vector<vector<int>>;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int digsum(int n) {
    int res = 0;
    while (n > 0) {
        res += n % 10;
        n /= 10;
    }
    return res;
}
#include <iomanip>

// vector vの中のn以下の数で最大のものを返す
int bs(vector<ll>& v, vector<ll>& fb, ll k) {
    int ok = 0;          //これがx以下
    int ng = 100000000;  // x以上
    // 問題によってokとngを入れ替える
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        if (mid <= k)
            ok = mid;
        else
            ng = mid;
    }
    return ok;
}

//約数全列挙
vector<long long> divisor_efficiency(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i != 1 && i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());  // 昇順に並べる
    return ret;
}

//素数判定（効率前処理なし）
bool is_prime_efficiency(long long n) {  // is n prime or not
    for (long long i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return true;
}

vector<pair<long long, long long> > prime_factor(long long n) {
    vector<pair<long long, long long> > ret;
    for (long long i = 2; i * i <= n; i++) {
        if (n % i != 0) continue;
        long long tmp = 0;
        while (n % i == 0) {
            tmp++;
            n /= i;
        }
        ret.push_back(make_pair(i, tmp));
    }
    if (n != 1) ret.push_back(make_pair(n, 1));
    return ret;
}

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    /////////////////////////////////////////////////////

    string s;
    cin >> s;
    int count = 0;

    rep(i,9){
        if(s.substr(i,4) == "ZONe") count++;
    }
    cout  << count << endl;

    //////////////////////////////////////////////////////
    return 0;
}

#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) begin(x),end(x)
#define F(i,n) for (int i = 0; i < n; ++i)
#define F1(i,n) for (int i = 1; i <= n; ++i)
#define dbg(x) cerr << #x << " = " << x << endl
#define dbgg(x) cerr << #x << " = " << x << ' '
#define T(x) x[pool]
#define mineq(x,y) { if ((x) > (y)) (x) = (y); }
#define maxeq(x,y) { if ((x) < (y)) (x) = (y); }
#define MEOW cout << "meowwwww" << '\n'; system("pause");
#define int long long
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;

template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c)
{
	s << "[ "; for (auto it : c) s << it << " "; s << "\b]\n";
	return s;
}

template<typename T>
ostream& operator <<(ostream &s, const pair<int, T> &c)
{
	s << "[ "; cout << c.fi << " , " << c.se << " ] ";
	return s;
}

const int maxn = 345678;
int n;
int a[maxn], pre[maxn];
map<int, int> cnt;

void input()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	F1 (i, n) cin >> a[i];
}

void solve()
{
	F1 (i, n) if (i & 1) pre[i] = pre[i - 1] + a[i];
		else pre[i] = pre[i - 1] - a[i];
	F (i, n + 1) ++cnt[pre[i]];
	int ans = 0;
	for (auto x : cnt) ans += x.se * (x.se - 1) / 2;
	//F (i, n + 1) dbgg(pre[i]);
	cout << ans << '\n';
}

main()
{
	input();
	solve();
}
