n = int(input())

a = [int(x) for x in input().split()]

for i in range(1,n):
    a[i] += a[i-1]

a = [0] + a

ans = 0

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

print(ans)