#include <bits/stdc++.h>
using namespace std;
int main() {
  int cosum;
  bool floop;
  int n;
  int output = 0;
  cin >> n;
  vector<int> v(n);
  for (int k = 0; k < n; ++k) {
    cin >> v[k];
  }
  for (int i = 2; i <= n; ++i) {
    for (int j = 0; j <= v.size() - i; ++j) {
      cosum = 0;
      floop = false;
      for (int f = 0; f < i; ++f) {
        cosum += v[j + f];
        floop = true;
      }
      if (cosum == 0 && floop == true) {
        ++output;
      }
    }
  }
  cout << output;
}
