n = int(input())
a = list(map(int, input().split(" ")))
s = []
s.append(0)
counter = 0
for i in range(n):
    s.append(s[i] + a[i])
s.sort()
for i in range(len(s)):
    if i+1 < len(s) and s[i] == s[i+1]:
        counter += 1
print(counter)