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

sum_A = [0]*(N+1)
sumcnt = {}
for i in range(N):
    sum_A[i+1] =sum_A[i]+A[i]

ans = 0
sum_A = sorted(sum_A)

for i in range(N):
    if(sum_A[i] == sum_A[i+1]):
        ans += 1
print(ans)