n = int(input())
a = [int(i) for i in input().split()]
sum = [0 for i in range(n)]
counter = 0
for i in range(n):
  for j in range(i + 1):
    sum[j] += a[i]
    if(sum[j]) == 0:
      counter += 1

print(counter)