import bisect

n = int(input())
nums = list(map(int, input().split(" ")))
sigma = []
temp = 0
for num in nums:
    temp += num
    sigma.append(temp)

ans = 0
for i, s in enumerate(sigma):
    if s == 0:
        ans += 1
    beforeSums = sorted(sigma[:i])
    li = bisect.bisect_left(beforeSums, s)
    if li >= i:
        continue
    while beforeSums[li] == s:
        ans += 1
        li += 1
        if li >= i:
            break
print(ans)
