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

s = sum(a)
b = []
c = []
t = 0


for i in a:
    b.append(t)
    t += i
    c.append(s-t)
    
ans = 0
for i in range(n):
    for j in range(i, n):
        if b[i] + c[j] == s:
            ans += 1
print(ans)