# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
j = 0
tmp = 0
cnt = 0
for i in range(N-1):
    for j in range(i+1, N+1):
        #print(i, j, sum(A[i:j]))
        if sum(A[i:j]) == 0:
            cnt += 1
print(cnt)