#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(void) {
  ll N;
  ll a[N];
  cin >> N;
  ll ans = 0;
  ll sum = 0;
  for (ll i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (ll i = 0; i < N; i++) {
    for (ll j = i; j < N; j++) {
      sum = sum + a[j];
      if (sum == 0) {
        ans = ans + 1;
      }
    }
    sum = 0;
  }
  cout << ans;
}
