#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; int main(){ ll 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))); dp[0][0][0] = 1; for (int i=1; i<=N; i++){ for (int j=0; j<=N; j++){ for (int k=0; k<=5000; k++){ dp[i][j][k] += dp[i-1][j][k]; if (j-1>=0 && k-A[i-1]>=0) dp[i][j][k] += dp[i-1][j-1][k-A[i-1]]; } } } for (int i=2; i<=N; i++){ for (int j=1; j=A[i-1]*j ) ans += dp[i-1][j][k]; } } } cout << ans << endl; }