#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(int argc, const char* argv[]) {
  ll n, a;
  cin >> n;
  vector<ll> v(n);
  for (ll i = 0; i < n; i++) {
    cin >> a;
    v[i] = a;
  }
  ll cnt = 0, sum;
  for (ll i = 0; i < n; i++) {
    sum = v[i];
    for (ll j = i + 1; j < n; j++) {
      sum += v[j];
      if (sum == 0) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
