#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ long long N, ans=0; cin >> N; vector A(N); for (int i=0; i> A[i]; sort(A.begin(), A.end()); vector>> dp(N+1, vector(N+1, vector(5001))); for (int i=0; i<=N; i++) dp[i][0][0] = 1; for (int i=1; i<=N; i++){ for (int j=1; j<=N; j++){ for (int k=0; k<=5000; k++){ dp[i][j][k] += dp[i-1][j][k]; if (k>=A[i-1]) dp[i][j][k] += dp[i-1][j-1][k-A[i-1]]; } } } for (int i=0; i=j*A[i]) ans += dp[i][j][k]; } } } cout << ans << endl; return 0; }