#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int count = 0;
  int check = 0;
  vector<int> an(n);
  for (auto iter = an.begin(); iter != an.end(); ++iter) {
    cin >> *iter;
  }
  for (int i = 0; i < n - 1; ++i) {
    check = an.at(i);
    for (int k = i + 1; k < n; ++k) {
      check += an.at(k);
      if (check == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
  return 0;
}
