#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
ll N;
ll A[200003];
int main() {
  cin >> N;
  A[0] = 0;
  for (ll i = 1; i <= N; i++) {
    ll a;
    cin >> a;
    A[i] = A[i - 1] + a;
  }
  ll cnt = 0;
  for (ll i = 0; i <= N; i++) {
    for (ll j = i + 1; j <= N; j++) {
      if ((A[j] - A[i]) == 0) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}
