#include <bits/stdc++.h>
#define st first
#define nd second
#define PQ priority_queue
#define MP make_pair

using ll = long long ;
using namespace std;
using pii = pair<int,int>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using pll = pair<ll, ll>;
const int N = 105;
const int MAXN = 1e5 + 10;
const int MOD = 0;
bool dp[MAXN];
int a[N];
int main(){
	int n, ma = 0, sum = 0;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		sum += a[i];
		ma = max(ma, a[i]);
	}
	int half = sum / 2;
	if (ma >= half) {
		return !printf("%d", max(ma, sum - ma));
	}
	dp[0] = true, ma = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = half; j - a[i] >= 0; j--) {
			dp[j] = dp[j] || dp[j - a[i]];
			if (dp[j]) ma = max(ma, j);
		}
	}
	printf("%d", sum - ma);


}
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int n;
    cin >> n;
    vi t(n);
    rep(i, n) {
        cin >> t[i];
    }
    vector<ll> cur(2e5, INF);
    cur[0] = 0;
    rep(i, n) {
        vl nxt(cur.size(), INF);
        rep(j, cur.size()) {
            chmin(nxt[j], cur[j] + t[i]);
            if(j + t[i] < cur.size()) chmin(nxt[j+t[i]], cur[j]);
        }
        swap(cur, nxt);
    }
    ll ans = INF;
    rep(i, cur.size()) {
        chmin(ans, max((ll)i, cur[i]));
    }
    cout << ans << endl;

    return 0;
}