n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    for j in range(n - i):
        sum_a = sum(a[j:j + i + 1])
        print(a[j:j + i + 1],sum_a)
        if sum_a == 0:
            ans += 1
print(ans)