#include <bits/stdc++.h>
int ar(int start, int end, long* A) {
  long res = 0;
  for (int i = start; i <= end; i++) {
    res += A[i];
  }
  return res;
}
int main(void) {
  int N, count = 0;
  long A[200000];
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%ld", &A[i]);
  }
  for (int start = 0; start < N - 1; start++) {
    for (int end = start; end < N; end++) {
      if (ar(start, end, A) == 0) {
        count++;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}
