n = int(input())
A = [int(i) for i in input().split()]
ans = 0

for i in range(n-1):
    for j in range(i+1,n+1):
            s = sum(A[i:j])
            if s == 0:
                ans += 1

print(ans)