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