#include<bits/stdc++.h>
#define PI 3.141592653589793238462
#define eps 1e-20
#define fi first
#define se second
using namespace std;
using cd = complex<double>;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll a[105],d[100005];
int main(){
    ll n,sum=0;cin>>n;
    for(ll i=1;i<=n;i++){
        cin>>a[i];sum+=a[i];
    }
    d[0]=1;
    for(ll i=1;i<=n;i++){
        for(ll j=sum;j>=a[i];j--){
            d[j]|=d[j-a[i]];
        }
    }
    ll ans=sum;
    for(ll i=0;i<=sum;i++){
        if(!d[i]) continue;
        ans=min(ans,max(i,sum-i));
    }
    cout<<ans<<endl;
} 
#include <bits/stdc++.h>
using namespace std;
using Table = vector<vector<int>>;

template<typename T>
bool chmin(T &a, T b)
{
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

int main()
{
    int N;
    cin >> N;
    vector<int> T(N);
    for (auto &Ti : T)
        cin >> Ti;
    constexpr int INF = 2e+5;
    int max_T = *max_element(T.begin(), T.end());
    Table dp(N + 1, vector<int>(max_T * N + 1, INF));
    dp[0][0] = 0;
    for (int i = 0; i < N; ++i) {
        auto Ti = T.at(i);
        for (int j = 0; j <= max_T * N; ++j) {
            int k = Ti + j;
            if (k <= max_T * N)
                chmin(dp[i + 1][k], dp[i][j]);
            chmin(dp[i + 1][j], dp[i][j] + Ti);
        }
    }
    int min_cost = INF;
    for (int j = 0; j <= max_T * N; ++j)
        chmin(min_cost, max(j, dp[N][j]));
    cout << min_cost << endl;
}
