# -*- coding: utf-8 -*-
import numpy

def main():
	N = int(input())
	A = list(map(int,input().split()))
	c = 0
	for i in range(1,N+1):
		B = list(A)
		C = list(A)
		del B[0:i]
		del C[N-i:N]
		d = numpy.cumsum([x - y for (x, y) in zip(B, C)]) #累積和
		D = d.tolist() #numpy.ndarrayからlistへの変換
		D.insert(0,0)
		E = list(map(lambda x: x+sum(A[0:i]), D))
		c += E.count(0)
	print(c)

if __name__ == '__main__':
    main()
