N = int(input())
A = [int(i) for i in input().split()]
 
B = [0]
[B.append(B[i]+A[i]) for i in range(N)]
B.sort()
 
ans = 0
for i in range(N):
    for j in range(i+1,N+1):
        if B[i] == B[j]:
            ans += 1
        else:
            break
 
print(ans)