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