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