#include<stdio.h>
#include<stdlib.h>
#define MAX 200000


int main(void){
  int num;
  int *data;
  int i,j;
  int temp;
  int counter = 0;
  
  scanf("%d",&num);
  if((data = malloc(sizeof(int) * num)) == NULL){
    printf("malloc error\n");
    exit(-1);
  }
  for(i = 0;i < num; i++)
    scanf("%d",&data[i]);
    
  for(i = 0;i < num;i++){
    temp = 0;
    for(j = i;j < num; j++){
      temp += data[j];
      if(temp == 0){
	counter++;
	//break;
      }
    }
  }

  printf("%d\n",counter);
  return 0;
}
    
