N=int(input().rstrip())
A=list(map(int, input().rstrip().split())) #input parameters
count=int()
for i in range(0,N):
    work=int(0)
    for j in range(i,N):
        work+=A[j]
        if work==0:
            count+=1
print(count)