N=int(input())
A=[int(x) for x in input().split()]
cnt=0
def sum(a):
	re=0
	for i in a:
		re+=i
	return re

for i in range(N):
	for j in range(i,N):
		b=A[i:j+1]
		if sum(b)==0:
			#print(b)
			#print(sum(b))
			cnt+=1

print(cnt)