N=int(input())

A=list(map(int,input().split()))

seen=[[0]*N for i in range(N)]
sum=[[10**10]*N for _ in range(N)]
sum[0][0]=A[0]
seen[0][0]=1
stack=[[0,0]]

cnt=0
while stack:
    x,y=stack.pop()
    if x+1<=y<N and seen[x+1][y]==0:
        sum[x+1][y]=sum[x][y]-A[x]
        if sum[x+1][y]==0:
            cnt+=1
        seen[x+1][y]=1
        stack.append([x+1,y])
    if x<=y+1<N and seen[x][y+1]==0:
        sum[x][y+1]=sum[x][y]+A[y+1]
        if sum[x][y+1]==0:
            cnt+=1
        seen[x][y+1]=1
        stack.append([x,y+1])
print(cnt)


