#include <iostream>
using namespace std;
long long A[200001];
long long count,N,sum;
int main(){
    sum = 0;
    count = 0;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        for(int j = 0; j <= i; j++){
            sum += A[i - j];
            if(sum == 0){
                count++;
            }
        }
        sum = 0;
    }
    cout << count << endl;
    return 0;
}