N = int(input())
A = list(map(int, input().split()))
S = [0]*(N+1)
sum_A = 0
cnt = 0

for i in range(N):
    S[i+1] = S[i] + A[i] 
S = sorted(S)

for j in range(N):
    if(S[j] == S[j+1]):
        cnt += 1
print(cnt)