#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
ll N;
ll A[200001];
int main() {
  cin >> N;
  for (ll i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll cnt = 0;
  for (ll i = 0; i < N; i++) {
    for (ll j = i; j < N; j++) {
      if (std::accumulate(&A[i], &A[j] + 1, 0) == 0) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}
