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 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] += sum(dp[j-1][k-A[i]]) else: ndp[j][k][0] += sum(dp[j-1][k-A[i]]) dp = ndp res = 0 for j in range(2,N+1): for k in range(100*N+1): res += dp[j][k][1] print(res)