import sys

n = input()
a = list(map(int, input().split()))

ans = 0

for i in range(len(a)-1):
    flag = False
    for j in range(i+2, len(a)+1):
        if not(flag):
            if a[i]*a[j-1] <= 0:
                flag = True
        if flag:
            if sum(a[i:j-1]) == 0:
                ans += 1

print(ans)
