n = int(input())

a = list(map(int, input().split()))
cnt = 0
b = 0
for i in range(n):
    b += a[i]
    if b == 0:
        cnt += 1
    c = b
    for j in range(i):
        c -= a[j]
        if c == 0:
            cnt +=1
            
print(cnt)