import sys
input=sys.stdin.readline

N = int(input())
A = [0] + list(map(int, input().split()))

B = []
for i in range(len(A)):
    tmp = A[0:i+1]
    B.append(sum(tmp))
B.sort()

ans = 0
for i in range(len(B)-1):
    for j in range(i+1,len(B)):
        if B[j]-B[i] == 0:
            ans += 1
print(ans)
