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