#include <bits/stdc++.h>
using namespace std;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;
using ll = long long;
using PL = P<ll, ll>;
using PS = P<string, ll>;
using VI = V<int>;
using VVI = V<VI>;
using VL = V<ll>;
using VVL = V<VL>;
using VS = V<string>;
using VB = V<bool>;
using VVB = V<VB>;
using VPL = V<PL>;
using VPS = V<PS>;
template <typename T>
T square(T a) {
  return a * a;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  VL A(N + 1);
  VL S(N + 1);
  S[0] = 0;
  for (ll i = (1); i <= (N); i++) {
    cin >> A[i];
    S[i] = S[i - 1] + A[i];
  }
  ll ans = 0;
  for (ll i = (1); i <= (N); i++) {
    for (ll j = (i); j <= (N); j++) {
      if (S[j] - S[i - 1] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
