#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const ll N = 105, inf = 4e18 + 4, mod = 1e9 + 7;   ll n, a2[N], num[N], ans, sum, dp[N][N * N], tmp[N][N * N], fac[N], inv[N];   bool mark[N];   ll pw(ll a, ll b) {     if (b == 0) return 1;     a %= mod;     if (b % 2 == 1) return a * pw(a, (b - 1)) % mod;     return pw((a * a % mod), (b / 2)) % mod;   }   ll choose(ll a, ll b) {     if (b > a) return 0;     if (b == 0 || b == a) return 1;     return fac[a] % mod * inv[b] % mod * inv[a - b] % mod;   }   int main() {     ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);     tmp[0][0] = 1;     fac[0] = 1;     for (ll i = 1; i < N - 1; i++) fac[i] = (fac[i - 1] * i) % mod;     inv[N - 2] = pw(fac[N - 2], mod - 2) % mod;     for (ll i = N - 3; i >= 0; i--) {       ll x = i + 1;       inv[i] = (inv[x] * (x)) % mod;     }     cin >> n;     ll y = 0;     for (ll i = 0; i < n; i++) {       cin >> a2[i];       if (!mark[a2[i]]) {         mark[a2[i]] = 1;         y++;       }       num[a2[i]]++;       sum += a2[i];       for (ll j = 0; j < n; j++) {         for (ll k = a2[i]; k <= sum; k++) {           dp[j + 1][k] = tmp[j][k - a2[i]];         }       }       for (ll j = 0; j <= n; j++) {         for (ll k = 0; k <= sum; k++) {           (tmp[j][k] += dp[j][k]) % mod;           dp[j][k] = 0;         }       }     }     if (y < 3) {       cout << n << endl;       return 0;     }     for (ll i = 100; i >= 1; i--) {       for (ll j = num[i]; j > 0; j--) {         if (choose(num[i], j) != tmp[j][j * i]) continue;         ans = max(ans, j);       }     }     cout << ans << endl;   }   