import sys input = lambda: sys.stdin.readline().rstrip() ################## n = int(input()) A = list(map(int, input().split())) A.sort() dp = [[[0 for _ in range(n+1)] for _ in range(6000)] for _ in range(n+1)] dp[0][0][0] = 1 ans = 0 for i in range(n): for j in range(5001): for k in range(n): dp[i+1][j][k] += dp[i][j][k] dp[i+1][j+A[i]][k+1] += 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)