number_of_item = int(raw_input())
items = list(map(int,raw_input().split()))
count = 0
for i in range (number_of_item):
    for j in range (number_of_item-i):
        if sum(items[i:i+j+1]) == 0:
            count += 1
print count