#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[200000];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int range = 2;
  int total = 0;
  int sum = n;
  bool flag = true;
  while (range <= sum) {
    for (int i = 0; i < sum - range + 1; i++) {
      int temp = 0;
      for (int j = 0; j < range; j++) {
        temp += a[i + j];
      }
      if (temp == 0) {
        total++;
      }
    }
    range++;
  }
  cout << total << endl;
  return 0;
}
