n = int(input())
s = list(map(int, input().split()))
count = 0
cl = []
sm = 0
for i in range(n):
  sm+=s[i]
  cl.append(sm)

for i in range(n):
  for j in range(i, n):
    if i==0:
      if cl[j]==0:
        count+=1
    else:
      if cl[j]-cl[i-1]==0:
        count+=1
        
print(count)