#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (auto&& an : a) {
    cin >> an;
  }
  vector<long long> b(n);
  b[0] = a[0];
  for (int i = 1; i < n; i++) {
    b[i] = a[i] + b[i - 1];
  }
  long long out = 0;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = i - 1; j >= 0; j--) {
      if (b[i] - b[j] == 0) {
        out++;
      }
    }
    if (b[i] == 0) {
      out++;
    }
  }
  cout << out << endl;
  return 0;
}
