#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0;
  int t;
  vector<int> a;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    a.push_back(t);
  }
  int sum = 0;
  int count = 0;
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j < n; j++) {
      sum = 0;
      if (j + i > n) {
        continue;
      }
      for (int k = 0; k < i; k++) {
        sum += a[j + k];
      }
      if (sum == 0) {
        count++;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}
