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

int main(void){
	int i,j;
	int num;
	int sum =0;
	int ans = 0;
	double *A;
	
	scanf("%d",&num);
	A = (double *)malloc(sizeof(double)*num);
	
	for(i = 0;i <num ; i++){
		scanf("%lf",&A[i]);
		if(A[i] == ""){
			 return -1;
		}
	}
	
	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;
}