n=int(input()) l=list(map(int,input().split())) t=sum(l) k=1 d=[] while k*k<=t: if t%k<1: d+=[k,t//k] k+=1 d=sorted(list(set(d))) for m in d: b=[] c=0 for j in range(n): b+=[l[j]] if sum(b)>m: break elif sum(b)==m: c+=1; b=[] if c*m==t: print(c); break