from itertools import accumulate
N=int(input())
A=[int(i) for i in input().split()]
B=list(accumulate(A))
B.insert(0,0)
C=list(accumulate(A[::-1]))[::-1]
C.insert(0,0)
C.append(0)
c=0
for i in range(N+1):
    for j in range(i+1,N+1):
        #print(i,j,sum(A[i:j]),B[-1]-B[i]-C[j+1])
        if B[-1]-B[i]-C[j+1] == 0:
            c+=1
print(c)