n=int(input()) a=[-1]+list(map(int,input().split())) a.sort() ans=0 def f(i,j,s): return (i*(n+2)+j)*5050+s dp=[0]*(n+3)**2*5500 dp[f(0,0,0)]=1 for i in range(n): for j in range(i+1): for s in range(5001): dp[f(i+1,j,s)]+=dp[f(i,j,s)] dp[f(i+1,j+1,s+a[i+1])]+=dp[f(i,j,s)] ans=0 for i in range(2,n+1): for j in range(2,i+1): for s in range(5001): if s%(j-1)!=0:continue k=s//(j-1) if a[i]>k:continue if s-a[i]<0:continue ans+=dp[f(i-1,j-1,s-a[i])] print(ans)