#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve();
int main() { solve(); }
void solve() {
  ll n, A[200001];
  scanf("%lld", &n);
  A[0] = 0;
  for (ll i = 1; i <= n; i++) scanf("%lld", A + i), A[i] += A[i - 1];
  ll count = 0;
  for (ll i = 0; i < n; i++)
    for (ll j = i + 1; j <= n; j++)
      if (A[j] - A[i] == 0) count++;
  printf("%lld\n", count);
}
