#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>

int64_t A[200000];
int64_t sumList[200000];

int main(void) {
	uint32_t N;
	uint32_t zeroCount = 0;

	scanf("%"PRIu32"\n", &N);

	for (uint32_t idx = 0; idx < N; idx++) {
		sumList[idx] = 0;
	}

	for (uint32_t idx = 0; idx < N - 1; idx++) {
		scanf("%"PRId64" ", &(A[idx]));
	}
	scanf("%"PRId64, &(A[N - 1]));

	for (uint32_t beginIdx = 0; beginIdx < N; beginIdx++) {
		for (uint32_t idx = beginIdx; idx < N; idx++) {
			if (beginIdx != 0) {
				sumList[idx] -= A[beginIdx - 1];
			}
			if (idx != beginIdx) {
				sumList[idx] = sumList[idx - 1] + A[idx];
			}
			else {
				sumList[idx] = A[idx];
			}
			if (sumList[idx] == 0) {
				zeroCount++;
			}
		}
	}

	printf("%"PRIu32, zeroCount);

	return 0;
}
