n = int(input())
a = list(map(int, input().split()))
a_sum = [0]
a_ = 0
for i in range(n):
    a_ = a_ + a[i]
    a_sum.append(a_)
count = 0
for i in range(n + 1):
    for j in range(i + 1, n + 1):
        if a_sum[i] == a_sum[j]:
            count = count + 1
print(count)