N = int(input())
AAA = [int(i) for i in input().split()]
BBB = [0]
for a in AAA:
    BBB.append(a+BBB[-1])
ans=0
for i in range(N+1):
    for j in range(i+1,N+1):
        if BBB[i]==BBB[j]:
            ans+=1
print(ans)