import collections
n = int(input())
a = list(map(int, input().split()))
po = []
num = 0
po.append(num)
for i in a:
    num += a
    po.append(num)

po.sort()
count = collections.Counter(po)
print(sum(count.items()))
