n = int(input())
l = [int(x) for x in  input().split()]

o = len(l)
count = 0

for i in range(n):
    for j in range(o):
        if i >= j+1:
            continue
        sum = 0
        for a in l[i:j+1]:
            sum = sum + a
        if sum == 0:
            count = count + 1
print(count)
