# https://agc023.contest.atcoder.jp/tasks/agc023_a

N = list(map(int, input()))[0]

li = list(map(int, input().split()))

# print(N)
#
# print(li)


counter = []

found = 0

for i in li:
    for j in range(len(counter)):
        counter[j] += i
        if counter[j] == 0:
            found += 1
    counter.append(i)
    if i == 0:
        found += 1

print(found)

