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

s = []

for i in range(n):
    s.append(sum(a[:i+1]))
s.append(0)

x = 0

for i in range(n):
    for j in range(n-i):
        if s[j]==s[j+i+1]:
            x += 1
print(x)