#include <bits/stdc++.h>
int main() {
  unsigned long N;
  long long A[200000];
  long long sum;
  unsigned long cnt = 0;
  scanf("%lu", &N);
  for (unsigned long i = 0; i < N; i++) scanf("%lld", &A[i]);
  for (unsigned long i = 0; i < N; i++) {
    sum = 0;
    for (unsigned long j = i; j < N; j++) {
      sum += A[j];
      if (sum == 0) cnt++;
    }
  }
  printf("%ld\n", cnt);
  return 0;
}
