#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > create_comb(vector<int> l) {
  int i, j, n;
  vector<vector<int> > comb;
  unsigned long size = l.size();
  for (i = 0; i < size; i++) {
    for (n = 2; n < size; n++) {
      if (n + i > size) {
        continue;
      }
      vector<int> group;
      for (j = i; j < n + i; j++) {
        group.push_back(l[j]);
      }
      if (group.size() != n) {
        group.clear();
        continue;
      }
      comb.push_back(group);
      group.clear();
    }
  }
  return comb;
}
int main() {
  int n, i, tmp, count = 0;
  vector<int> a, c;
  vector<vector<int> > combi;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> tmp;
    a.push_back(tmp);
  }
  combi = create_comb(a);
  for (i = 0; i < combi.size(); i++) {
    if (accumulate(combi[i].begin(), combi[i].end(), 0) == 0) {
      count += 1;
    }
  }
  cout << count << endl;
  return 0;
}
