#include <stdio.h>
#include <stdlib.h>

int main(void) {
  int n, count = 0;
  long *a, i, j, sum = 0, start;

  scanf("%d", &n);
  a = malloc(sizeof(int) * n);

  for (i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }

  for (i = 0; i < n; i++) {
    start = a[i];
    sum = start;
    for (j = i + 1; j < n; j++) {
      sum += a[j];
      if (sum == 0) {
        count++;
      }
    }
  }

  printf("%d\n", count);

  return 0;
}