N=int(input()) A=list(map(int,input().split())) A_sum=sum(A) DP=[[0]*(A_sum+1) for _ in range(N+1)] DP[0][0]=1 A.sort() Ans=0 for p,a in enumerate(A,1): for n in range(N,0,-1): D=DP[n] E=DP[n-1] for s in range(A_sum,a-1,-1): D[s]+=E[s-a] if n>=2 and s>=(n-1)*a and s%(n-1)==0: Ans+=E[s-a] print(Ans)