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