N = int(input()) A = list(map(int, input().split())) A.sort() dp = [[[0] * 60 for _ in range(6000)] for _ in range(60)] dp[0][0][0] = 1 ans = 0 for i in range(N): for j in range(5000 + 1): for k in range(N): dp[i + 1][j + A[i]][k + 1] += dp[i][j][k] dp[i + 1][j][k] += dp[i][j][k] if k >= 1: if (j + A[i]) % k == 0 and k * A[i] <= j + A[i]: ans += dp[i][j][k] print(ans)