#include <bits/stdc++.h>
int64_t N;
int64_t A[200000];
using namespace std;
int main() {
  scanf("%lld", &N);
  for (int64_t i = 0; i < N; i++) {
    cin >> A[i];
  }
  int64_t count = 0;
  for (int64_t i = 0; i < N; i++) {
    int64_t s = A[i];
    for (int64_t j = i + 1; j < N; j++) {
      s += A[j];
      if (s == 0) {
        count += 1;
      }
    }
  }
  printf("%lld\n", count);
}
