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