#include <iostream>
#include <cstdio>
using namespace std;


int count(int N, int A[]) {
	int result = 0;
	int i, j;
	long long sum = 0;
	for (i = 0;i < N;i++) {
		for (j = i;j < N;j++) {
			sum += A[j];
			if (sum == 0)result++;
		}
		sum = 0;
	}
	return result;
}


int main() {
	int N,t;
	int A[200000];
	scanf_s("%d\n",&N);
	int i;
	for (i= 0;i < N;i++) {
		scanf_s("%d ",&t);
		A[i] = t;
	}
	int r = count(N, A);
	cout << r << endl;
	return 0;
}