#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
int main() {
  ll n;
  cin >> n;
  vector<ll> s(n + 1);
  s[0] = 0;
  for (ll i = 0; i < n; i++) {
    ll a;
    cin >> a;
    s[i + 1] = s[i] + a;
  }
  ll ans = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (s[j] - s[i] == 0) ans++;
    }
  }
  cout << ans << endl;
}
