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

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

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