n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(len(a)-1):
    k = a[i]
    for j in range(i+1,len(a)):
        k += a[j]
        if k==0:
            ans+=1
            break
print(ans)