#include <bits/stdc++.h>
using namespace std;
bool isZero(vector<long> vec, long sPos, long n) {
  long sum = 0;
  long ii;
  for (ii = sPos; ii < sPos + n; ii++) {
    sum += vec[ii];
  }
  if (sum == 0) {
    return true;
  } else {
    return false;
  }
}
int main() {
  long res, jj, ii, n, sum = 0;
  vector<long> vec;
  cin >> n;
  vec.resize(n);
  for (ii = 0; ii < n; ii++) {
    cin >> vec[ii];
  }
  for (long sPos = 0; sPos < vec.size(); sPos++) {
    for (long n = 1; n <= vec.size() - sPos; n++) {
      if (isZero(vec, sPos, n)) {
        sum += 1;
      }
    }
  }
  cout << sum << endl;
  return 0;
}
