def into_ruiseki(a):
	n = len(a)
	ret = [0 for i in range(n + 1)]
	for i in range(n):
		ret[i + 1] = ret[i] + a[i]
	return ret

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

left = into_ruiseki(a)
right = into_ruiseki(a[::-1])

total = sum(a)
ans = 0
for i in range(n):
	for j in range(n - i):
		if total - left[i] - right[j] == 0:
			ans += 1
print(ans)
