N = int(input())
a = list(map(int, input().split()))
counter = 0
for i in range(N):
    for k in range(i,N):
        res = 0
        for j in range(i,k+1):
            res = res+ a[j]
        if res == 0:
            counter = counter + 1
print(counter)