#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long sum = 0;
  int c = 1;
  int count = 0;
  while (n != c) {
    for (int i = 0; i + c <= n; i++) {
      for (int j = i; j < i + c; j++) {
        sum += a[j];
      }
      if (sum == 0) count++;
      sum = 0;
    }
    c++;
  }
  cout << count << endl;
}
