#include <bits/stdc++.h>
using namespace std;
void zero_sum_range() {
  int n;
  vector<int> a;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  int total = 0;
  int count = 0;
  for (int i = 0; i < a.size(); i++) {
    total = 0;
    total += a[i];
    for (int j = i; j < a.size(); j++) {
      if (i == j) continue;
      total += a[j];
      if (total == 0) {
        count++;
        continue;
      }
    }
  }
  cout << count << endl;
}
int main() {
  zero_sum_range();
  return 0;
}
