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