#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];
  }
  int num = 0;
  for (int j = 1; j < n; j++) {
    for (int i = 0; i < n - j; i++) {
      int sum = 0;
      for (int k = i; k < i + j + 1; k++) {
        sum = sum + a[k];
      }
      if (sum == 0) num++;
    }
  }
  int total = 0;
  for (int i = 0; i < n; i++) {
    total += a[i];
  }
  if (total == 0) num++;
  cout << num;
  return 0;
}
