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

int main(void) {
  int i, j;
  int n;
  int a;
  int *sum;
  int c;
  
  scanf("%d", &n);
  
  sum = malloc(sizeof(int) * n);
  
  c = 0;
  
  for (i = 0; i < n; i++) {
    scanf("%d", &a);
    sum[i] = 0;
    for (j = 0; j <= i; j++) {
      sum[j] += a;
      if (sum[j] == 0) {
        c++;
      }
    }
  }
  
  printf("%d", c);
  
  free(sum);

  return 0;
}