N = int(input()) A = list(map(int, input().split())) A.sort() dp = [[[0,0] for _ in range(100*N+1)] for _ in range(N+1)] dp[0][0][0] = 1 res = 0 for i in range(N): ndp = [[[0,0] for _ in range(100*N+1)] for _ in range(N+1)] for j in range(i+2): for k in range(100*N+1): ndp[j][k][0] += dp[j][k][0] ndp[j][k][1] += dp[j][k][1] if j-1>=0 and k-A[i]>=0: if j==1: ndp[j][k][0] += dp[j-1][k-A[i]][0] ndp[j][k][1] += dp[j-1][k-A[i]][1] else: if k%(j-1)==0 and A[i]<=k//(j-1): ndp[j][k][1] += dp[j-1][k-A[i]][0]+dp[j-1][k-A[i]][1] else: ndp[j][k][0] += dp[j-1][k-A[i]][0]+dp[j-1][k-A[i]][1] if i==N-1: res += ndp[j][k][1] dp = ndp print(res)