#include <bits/stdc++.h>
int64_t A[200000];
int main(void) {
  uint32_t N;
  uint32_t zeroCount = 0;
  scanf("%I32u\n", &N);
  for (uint32_t idx = 0; idx < N - 1; idx++) {
    scanf("%I64d ", &(A[idx]));
  }
  scanf("%I64d", &(A[N - 1]));
  for (uint32_t beginIdx = 0; beginIdx < N; beginIdx++) {
    int64_t sum = 0;
    for (uint32_t idx = beginIdx; idx < N; idx++) {
      sum += A[idx];
      if (sum == 0) {
        zeroCount++;
      }
    }
  }
  printf("%I32u", zeroCount);
  return 0;
}
