#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ui = unsigned int;
const ll MOD = 1000000007;
const ll INF = 9223372036854775807;
int main() {
  ll N;
  scanf("%lld", &N);
  vector<ll> A(N + 1);
  A[0] = 0;
  for (ll i = 1; i <= N; i++) {
    scanf("%lld", &A[i]);
  }
  vector<ll> T(N + 1, 0);
  T[0] = A[0];
  for (ll i = 1; i <= N; i++) {
    T[i] = T[i - 1] + A[i];
  }
  ll result = 0;
  for (ll i = 1; i <= N; i++) {
    for (ll j = i; j <= N; j++) {
      if (T[j] - T[i - 1] == 0) {
        result++;
      }
    }
  }
  printf("%lld\n", result);
}
