#include <cstdio>
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
using namespace std;
long long a[200100];
long long b[200100] = {};
long long c[200] = {};
int main()
{
    int n;
    scanf("%d",&n)
    rep(i,n){
        scanf("%d",a[i]);
        b[i+1] = b[i]+a[i];
    }
    long long ans = 0;
    rep(i,n+1){
        REP(k,i+1,n+1){
            if(b[k]-b[i]==0) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}
