#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
//#define sum(start, end) accumulate(start, end, 0)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef string str;

using namespace std;
template <class T = ll> T in() { T _in; cin >> _in; return (_in); }

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

    ll N = in();
    ll val[200000];
    rep(i, N) {
        val[i] = in();
        if(val[i] == 0)
            cnt++;
    }

    int cnt = 0;
    for(int i = N-1; i > -1; i--) {
        REP(j, i+1, N) {
            val[j] = val[i] + val[j];
            if(val[j] == 0)
                cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}
