#include <bits/stdc++.h>   using namespace std;   const long long INF = 200000000 + 1;   const int N = 300006, M = 80;   int dp[2][101][10005], a[105], cnt[105];   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= n; i++) {       int cnt1 = 0;       for (int j = 1; j <= n; j++) {         if (a[i] == a[j]) cnt1++;       }       cnt[a[i]] = cnt1;     }     sort(a + 1, a + n + 1);     vector<int> v;     v.push_back(a[1]);     for (int i = 2; i <= n; i++)       if (a[i] != a[i - 1]) v.push_back(a[i]);     dp[0][0][0] = 1;     for (int i = 1; i <= v.size(); i++) {       for (int j = 0; j <= n; j++) {         for (int k = 0; k <= 100 * n; k++) {           dp[i % 2][j][k] = dp[1 - i % 2][j][k];           for (int l = 1; l <= cnt[v[i - 1]] && l <= j; l++) {             int z = l * v[i - 1];             if (k >= z)               dp[i % 2][j][k] = dp[i % 2][j][k] + dp[1 - i % 2][j - l][k - z];             if (dp[i % 2][j][k] > 10) dp[i % 2][j][k] = 10;           }         }       }     }     int ans = 1;     for (int i = 1; i <= n; i++) {       for (int j = i; j <= n; j++) {         if (a[j] != a[i]) break;         int sum = a[j] * (j - i + 1);         int z = j - i + 1;         if (dp[v.size() % 2][z][sum] == 1) ans = max(ans, z);       }     }     if (v.size() == 2) {       cout << n <<   n ;       return 0;     }     cout << ans <<   n ;   }   