import sys
sys.setrecursionlimit(10000)

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

ans = 0

for i in range(len(a)):
    for j in range(i + 1, len(a) + 1, 1):
        if(sum(a[i:j]) == 0):
            ans += 1 

print(ans)