N = int(input())
A = list(int(i) for i in input().split())
cnt = 0
n = 0

for i in range(N):
    for j in range(i, N):
        n += A[j]
        if n == 0:
            cnt += 1
    n = 0

print(cnt)
    