n= int(input())
a = list(int(i) for i in input().split())
s = [0]
for i in range(n):
  s.append(s[i]+a[i])
s = sorted(s,reverse =True)
ans = 0
for i in range(n):
  if s[i]== s[i+1]:
    ans += 1
print(ans)