n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
    total=0
    for j in range(i,n):
        total+=a[j]
        if total==0:
            cnt+=1
            break
print(cnt)

