import numpy as np
def count(A):
    n=0
    for k in range(1,len(A)+1):
     for i in range(0,len(A)-k+1):
       if np.sum(A[i:i+k])==0:
         n += 1
         #print("k",k,"i",i,"n",n,A[i:i+k])
    return n