n = int(input())
a = list(map(int, input().split()))

sign_change = []

for i in range(n-1):
	if a[i] * a[i+1] < 0:
		sign_change.append(i)

zero_list = []

for i in sign_change:
	left = i
	right = i

	while right >= 0:
		while left <= n:
			if a[right:left] != [] and sum(a[right:left]) == 0:
				if [right, left] not in zero_list:
					zero_list.append([right, left])

			left += 1

		right -= 1
		left = right

print(len(zero_list))