#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> v;
  v.resize(n);
  for (auto&& e : v) {
    cin >> e;
  }
  long long cnt = 0;
  for (long long i = 0; i < n; ++i) {
    long long tmp = 0;
    for (long long j = i; j < n; ++j) {
      tmp += v[j];
      if (tmp == 0) {
        ++cnt;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
