N=int(input())
a=list(map(int,input().split()))
acc_s=[]
acc_s.append(0)
for i in range(N):
  if i==0:
    acc_s.append(a[i])
  else:
    acc_s.append(a[i]+acc_s[-1])
cnt=0
for i in range(N):
  for j in range(i+1,N+1):
    if acc_s[j]-acc_s[i]==0:
      cnt+=1
print(cnt)