#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n, 0), b(n, 0);
  long long bb = 0;
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    bb += a.at(i);
    b.at(i) = bb;
  }
  long long k = 0;
  for (int i = 0; i < n; i++) {
    if (b.at(i) == 0) {
      k++;
    }
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < i; j++) {
      if (b.at(i) - b.at(j) == 0) {
        k++;
      }
    }
  }
  cout << k << endl;
  return 0;
}
