n = int(input())
a = list(map(int, input().split()))

ans = 0

for i in range(n):
    sum_list = [sum(a[i:j]) for j in range(i + 1, n + 1)]
    print(sum_list)
    ans += sum_list.count(0)
    
print(ans)