#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int l, i = 0, a[n];
  while (cin >> l) {
    a[i] = l;
    i++;
  }
  int cnt = 0;
  for (int j = 0; j < n; j++) {
    int tmp = 0;
    for (int k = 0; k < n - j; k++) {
      tmp += a[j + k];
      if (tmp == 0) {
        cnt = cnt + 1;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
