#include <bits/stdc++.h>
using namespace std;
int main() {
  string p;
  int n, a[200000], b, c, d, e = 0, f, g, h;
  cin >> n;
  for (b = 0; b < n; b++) {
    cin >> a[b];
  }
  for (b = 0; b < n; b++) {
    d = 0;
    for (c = b; c < n; c++) {
      d += a[c];
      if (d == 0) {
        e++;
      }
    }
  }
  cout << e << endl;
  return 0;
}
