n = int(input())
A = list(map(int,input().split()))
B = []
def Cumulative_sum(n,A):
  B=[0]
  for i in range(n):
    B.append(A[i] + B[i])
  return B
B = Cumulative_sum(n,A)
count = 0
for x in range(n):
  for y in range(x+1,n+1):
    if B[y] - B[x] == 0:
      count += 1
print(count)