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

for i in range(n):
    for j in range(i+1,n+1):
        t = a.copy()
        tmp = t[i:j]
 #       print(tmp)
        if sum(tmp) == 0:
            ans += 1

print(ans)


