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

int A[200000];
int minians;



int main(){
  int ans = 0;
  int n;
  int i =0, j = 0, k = 0;
  cin >> n;
  for(i = 0; i <= n -1; i++){
    cin >> A[i];
  }
  for(j = 0; j <= n - 1; j++){
    minians = 0;
    for(k  = 0;k + j <= n -1; k++){
      minians += A[j+k];
      //cout << minians << A[j+k] << endl;
      if( minians == 0){
        ans++;