import functools
import operator


N = int(input())
a = list(map(int, input().split()))
print(N)
print(a)
s = 0
for max_num in range(2, N):
    for index in range(N - max_num + 1):
        subset = a[index: index + max_num]
        result = functools.reduce(operator.add, subset)
        if result == 0:
            s += 1

print(s)