#include<stdio.h>
#define MAX 200000

int main(void){

int N;
int A[MAX]={0};
int i;

scanf("%d", &N);
for (i = 0; i < N; i++) {
  scanf("%d", &A[i]);
}

int m, n;
int sum, score;

for(m = 0; m < N; m++){
	for(n = m; n < N; n++){
		sum = 0;
		for(i = m; i <= n; i++){
			sum += A[i];
		}
		//printf("%d ", sum);
		if(sum == 0){
			score++;
		}
	}
}

//printf("\nscore=%d\n", score);
pritf("%d\n", score);

return 0;
}