n = int(input())
a = list(map(int,input().split()))
suml = []
nsum = 0
count =0
for i in range(n):
    suml.append(nsum)
    nsum +=a[i]
    for i2 in suml:
        if nsum - i2 == 0:
            count +=1
print(count)
