N = int(input())
A = list(map(int,input().split()))
B = [0]
for i in range(N):
    B.append(A[i]+B[i])
ans = 0
for i in range(N):
    for j in range(i+1,N+1):
        if B[j]-B[i]==0:ans+=1
print(ans)