#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<ll, ll>;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  vector<ll> A(N + 1, 0);
  for (ll i = 1; i <= N; i++) {
    cin >> A[i];
    A[i] += A[i - 1];
  }
  ll ans = 0;
  for (ll i = 1; i <= N; i++) {
    for (ll j = 1; j <= i; j++) {
      if (A[i] - A[j - 1] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
