n = int(input())
nums = list(map(int, input().split(" ")))
before = []
ans = 0
for n in nums:
    nextNums = []
    if n == 0:
        ans += 1
    nextNums.append(n)
    for bNum in before:
        if bNum + n == 0:
            ans += 1
        nextNums.append(bNum + n)
    before = nextNums
print(ans)
