N=int(input())
A=list(map(int,input().split()))
B=[A[0]]
for i in range(1,N):
  B.append(B[-1]+A[i])
B = [0]+B

cnt =0
for i in range(N+1):
  for j in range(i):
    #print(j,i,B[i]-B[j])
    if B[i]==B[j]:
      cnt +=1
      
print(cnt)