n = int(input())

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

count = 0

for i in range(n):
    sum = 0;
    for j in range(i,n):
        sum += a[j]
        if sum == 0:
            count += 1

print(count)
