import numpy as np
from sys import stdin
N=int(stdin.readline().rstrip())
a=[]
for i in range(N):
    a.append([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 i in sorted(res):
    if i == tmp:
        ans+=1
    tmp=i
print(ans)