#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int k = 0; k < n; ++k) {
    cin >> a.at(k);
  }
  int group = 0;
  for (int i = 0; i < n; ++i) {
    int sum = a.at(i);
    for (int j = i + 1; j < n; ++j) {
      sum += a.at(j);
      if (sum == 0) {
        group += 1;
      }
    }
  }
  cout << group << endl;
  return 0;
}
