def solve(n, a): dp = [[[0 for _ in range(60)] for _ in range(6000)] for _ in range(60)] dp[0][0][0] = 1 ans = 0 a.sort() for i in range(n): for j in range(0, 5001): 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] and dp[i][j][k] > 0: ans += dp[i][j][k] return ans n = int(input()) a = list(map(int,input().split())) print(solve(n, a))