n = int(input()) a = list(map(int,input().split())) a.sort() ans = 0 sum_max=100*50 + 1 sum_max = sum(a)+1 dp = [[0] * (sum_max) for _ in range(n+1)] dp[0][0] = 1 for i in range(1,n): max_ = a[i] ndp = [[0] * (sum_max) for _ in range(n+1)] for j in range(i+1): for k in range(sum_max): ndp[j][k] += dp[j][k] # print(n) if j > 0 and dp[j-1][k] > 0: ndp[j][k+a[i-1]] += dp[j-1][k] if (max_*j)-k <= max_: if j > 0 and (k+ max_) % j == 0: ans += ndp[j][k] # print(ndp,i,ans) dp = ndp[::] # for j in range(1,i+1): # for k in range(sum_max): # if (max_*j)-k <= max_: # if (k+ max_) % j == 0: # ans += dp[j][k] print(ans)