#include<cstdio>
#include<iostream>
typedef long long ll;
using namespace std;



int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N,count = 0;
  cin >> N;
  ll s[N]= {};
  for (int i = 0; i < N; i++){
    cin >> s[i];
  }
  for (ll i = 0; i < N; i++){
    for (ll j = N-1 ; j > i ; j--){
      for (ll k = i;k <= j;k++){
        ll sum = 0;
        sum += s[k];
        if (sum == 0) count++;
      }

    }
  }
  cout << count;
  return 0;
}