import numpy as np
from sys import stdin
N=int(stdin.readline().rstrip())
data=[int(x) for x in stdin.readline().rstrip().split()]
res = np.cumsum(data)
res=np.insert(res,0,0)
ans=0
tmp=float("inf")
for j in sorted(res):
    if j == tmp:
        ans+=1
    tmp=j
print(ans)