#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d, e, f, g;
  vector<long long int> v;
  while (cin >> a) {
    e = 0;
    for (b = 1; b <= a; b++) {
      cin >> c;
      v.push_back(c);
    }
    for (b = 0; b < v.size() - 1; b++) {
      c = v[b];
      for (d = b + 1; d < v.size(); d++) {
        c += v[d];
        if (c == 0) {
          e++;
        }
      }
    }
    if (a == 1) {
      if (v[0] == 0) {
        e = 1;
      }
    }
    cout << e << endl;
    v.clear();
  }
  return 0;
}
