N=int(input())
A=list(map(int,input().split()))
import copy
li=[0]
ans=0
temp=0

for j in range(N):
    ans+=A[j]
    li.append(copy.copy(ans))


for k in range(N):
    for l in range(k+1,N+1):
        if li[l]-li[k]==0:
            temp+=1
print(temp)
