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