#include <bits/stdc++.h>
int main(void) {
  int num, i, j;
  int sum = 0;
  int ans = 0;
  int *A;
  scanf("%d", &num);
  A = (int *)malloc(sizeof(int) * num);
  for (i = 0; i < num; i++) {
    scanf("%d", &A[i]);
  }
  for (i = 0; i < num; i++) {
    sum = A[i];
    for (j = i + 1; j < num; j++) {
      sum += A[j];
      if (sum == 0) {
        ans++;
      }
    }
  }
  printf("%d\n", ans);
  free(A);
  return 0;
}
