N = int(input())
A = list(map(int,input().split()))
import itertools
acc = [0]+list(itertools.accumulate(A))
#print(acc)
ans = 0
for i in range(N+1):
    for j in range(i):
        if acc[i]-acc[j]==0:
            ans += 1
            #print(i,j)
print(ans)