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

S = [0]

for i in A:
    S.append(S[-1] + i)

S.sort()

count = 0
for i,s in enumerate(S):
    for j in range(len(S)-i-1):
        if s == S[i+j+1]:
            count += 1
        else: break
    
print(count)