N = int(input())
A = list(map(int,input().split(" ")))
A.insert(0,0)
for i in range(1,N):
	A[i+1] += A[i]

cnt = 0
for i in range(N):
	for j in range(i+1,N+1):
		if A[j] - A[i] == 0:
			cnt += 1

print(cnt)
