n = int(input())
a = list(int(i) for i in input().split())
sa = [0] * n
# 累積和
for i in range(n-1):
    if i == 0:
        sa[i] = a[i]
    else:
        sa[i + 1] = sa[i] + a[i + 1]

print(sa.count(0))