#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  long long int b = 0, count = 0, c = 0, d = 0;
  for (long int j = 2; j <= n; j++) {
    for (long int k = 0; k < n - j + 1; k++) {
      for (long int l = 0; l < j; l++) {
        c = l + k;
        d = a.at(c);
        b += d;
      }
      if (b == 0) {
        count += 1;
      }
      d = 0;
      b = 0;
    }
  }
  cout << count << endl;
  return 0;
}
