n = int(input())
ai = list(map(int, input().split()))

s = [0]
for i in range(n):
    s.append(s[i] + ai[i])

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

print(cnt)
