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

ans = 0

for i in range(N):
    for j in range(i+1, N):

        x = 0
        for k in range(i, j+1):
            x += A[k]
        
        if x == 0:
            ans += 1

print(ans)