#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a[N];
  int res = 0;
  for (int i = 0; i < N; ++i) cin >> a[i];
  for (int start = 0; start < N; start++) {
    int sum = 0;
    for (int i = 0; i < N - start; ++i) {
      sum += a[i + start];
      if (sum == 0) {
        res++;
      }
    }
  }
  cout << res << endl;
}
