N = int(input())
A = list(map(int,input().split()))
ans = 0
L = []
for i in range(N) :
    for j in range(i+1,N+1) :
        L.append(sum(A[i:j]))
        if sum(A[i:j]) == 0 :
            ans += 1
print(ans)

