N = int(input())
l1 = input().split()
l2 = []
for num in l1:
    l2.append(int(num))

ans = 0
for i in range(N-1):
    value = []
    for j in range(i,N-1):
        value.append(int(l2[j]))
        if sum(value)==0:
            ans+=1

print(ans)
