N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
  num = A[i]
  j = i + 1
  while j < N:
    num += A[j]
    if num == 0:
      ans += 1
      j += 1
      if j < N:
        num += A[j]
    j += 1
print(ans)
      