N = int(input())
A = list(map(int, input().split()))

ans=0
B=[0]
for i in range(N):
    B.append(B[i]+A[i])

for k in range(N):
    for j in range(k+1,N+1):
        if B[j]-B[k]==0:
            ans+=1

print(ans)