n = int(input())
a = list(map(int, input().split()))
c = [0] * (n + 1)
for i in range(n):
  c[i + 1] = c[i] + a[i]
result = 0
for i in range(1, n + 1):
  for j in range(i):
    if c[i] - c[j] == 0:
      result += 1
print(result)
