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)
    
cu = list(set(c))

ans = 0
for i in range(n-1):
    if s-b[i] not in cu:
        continue
    for j in range(i, n):
        if b[i] + c[j] == s:
            ans += 1
print(ans)