from itertools import accumulate
import sys
input = sys.stdin.readline

n = int(input())
ans = [1]
a = list(map(int, input().split()))
for i in range(n):
    ans += list(accumulate(a[i:]))
print(ans.count(0))