n = int(input())
As = input().split()
As = [int(A) for A in As]
ss = [0]
sss = 0
for i in range(n):
        sss += As[i]
        ss.append(sss)
ans = 0
for i in range(0, n):
    for j in range(i + 1, n + 1):
        if ss[j] - ss[i] == 0:
            ans += 1
print(ans)