number = int(input())
numlist = list(map(int, input().split()))

count = 0

totallist = []
totallist.append(0)
for i in range(number):
  totallist.append(totallist[i] + numlist[i])

totallist.sort()

i = 0
j = 0

for i in range(number + 1):
  for j in range(i + 1, number + 1):
    if totallist[i] == totallist[j]:
      count += 1

print(count)

  
