import itertools

N = int(input())
A = list(map(int, input().split()))

c = [0] * (N+1)

for i in range(N):
    c[i+1] = c[i] + A[i]

cnt = 0
for i in range(N+1):
    for j in range(i+1, N+1):
        if c[j] - c[i] == 0:
            cnt += 1
print(cnt)
