n = int(input())
a = list(map(int, input().split())) # 横入力

cs = [0]
aa = 0
for i in range(n):
    aa += a[i]
    cs.append(aa)

ans = 0
for i in range(n):
    for j in range(i+1,n+1):
        if cs[j] - cs[i] == 0:
            ans += 1

print(ans)