n = int(input())
a = list(map(int,input().split()))
s = 0
y = 0
while s <= n - 1:
    t = s
    while t <= n - 1:
        x = 0
        for i in range(t - s + 1):
            x += a[s+i]
        if x == 0:
            y += 1
        t += 1
    s += 1
print(y)