# coding : utf-8
 
import numpy as np
 
N = int(input())
 
A = [int(i) for i in input().split()]
 
 
count = 0
 
#dist = [0 for i in range(N)]
dist = np.zeros(N)
 
for i in range(N):
	dist[:i+1] += A[i]
	#print(dist)
	count += sum(dist[:i+1]==0)
 
#print(dist)
 
print(count)