n=int(input())
a=list(map(int,input().split()))
gk=sum(a)
me=[0]
usr=[]
kgk=0
for i in range(n-1):
    kgk+=a[i]
    me.append(kgk)
    usr.append(gk-kgk)
usr.append(0)

ans=0
for i in range(n):
    for j in range(n-i):
        if gk-me[i]-usr[n-1-j]==0:
            ans+=1
print(ans)