N = int(input()) A = sorted(list(map(int, input().split()))) ans = 0 C = N + 5 S = sum(A) + 5 pre = [[0] * S for _ in range(C)] pre[0][0] = 1 for a in A: dp = [[0] * S for _ in range(C)] for c in range(C): for s in range(S): dp[c][s] += pre[c][s] if c and s - a >= 0: dp[c][s] += pre[c - 1][s - a] if c >= 2 and s % (c - 1) == 0 and s // (c - 1) >= a: ans += pre[c - 1][s - a] pre, dp = dp, pre print(ans)