n = int(input())
a = list(map(int,input().split()))
ans = 0
count = 0
for i in range(n):
    count = a[i]
    if count == 0:
        ans += 1
    for j in range(1,n-i):
        count += a[i+j]
        if count == 0:
            ans += 1
print(ans)