length = int(input())
hoge = [int(x) for x in input().strip().split()]

count = 0
total_sum = list()
dream = 0

hoges = [hoge[x:] for x in range(length)]

for x in hoges:
    dream = 0
    for y in x:
        dream += y
        if dream == 0:
            count+=1

print(count)