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

S = []
S.append(0)
for i in range(n):
    tmp = S[i]+A[i]
    S.append(tmp)
count = 0
for k in range(1,n+1):
    for i in range(n-k+1):
        total = S[k+i]-S[i]
        if (total == 0):
            count += 1
print(count)