#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<int> vec;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    vec.push_back(tmp);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = n - 1; j >= i; --j) {
      int sum = 0;
      for (int k = i; k <= j; k++) {
        sum += vec[k];
      }
      if (0 == sum) {
        ++ans;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
