N = int(input())

A_list = list(map(int, input().split(' ')))
A_len = len(A_list)

result = 0
for i in range(A_len):
    tmp = 0
    for j in range(i, A_len):
        tmp += A_list[j]
        if tmp == 0:
            result += 1

print(result)