#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i = (begin); i < (end); i++)
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define F first
#define S second
#define PB push_back
#define MP make_pair

using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;

void setIO()
{
    FAST_IO;
}

const int N = 110, M = 1e5+100;

int n, a[N]; bool dp[N][M];

int main()
{
    cin >> n;
    FOR(i, 0, n) cin >> a[i];
    FOR(i, 0, n+1) dp[i][0] = true;
    FOR(i, 0, M)
    {
        FOR(j, 1, n+1)
        {
            dp[j][i] = (i-a[j-1]>=0?dp[j-1][i]||dp[j-1][i-a[j-1]]:dp[j-1][i]);
        }
    }

    /*FOR(i, 1, n+1)
    {
        FOR(j, 0, M)
        {
            dp[i][j] = (j-a[i-1]>=0?dp[i-1][j]||dp[i-1][j-a[i-1]]:dp[i-1][j]);
        }
    }*/

    ll tot = 0;
    FOR(i, 0, n)
        tot += a[i];

    ll mx = 1e9;
    FOR(i, 0, tot+1)
    {
        if(dp[n][i]&&dp[n][tot-i])
        {
            ll maks = max((ll)i, tot-i);
            mx = min(mx, maks);
        }
    }

    cout << mx;
}

#include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define dbg(x) cerr << "|" << #x << ": " << x << "|" << '\n'
#define cout(x) cout << x << '\n'

constexpr ll pmod(ll n) {return ((n%1000000007) + 1000000007) % 1000000007;}

const int d4x[4] = {-1, 0, 1, 0}, d4y[4] = {0, 1, 0, -1};
const int d8x[8] = {-1, -1, -1, 0,  1, 1, 1, 0}, d8y[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int dkx[8] = {-1, -2, -2, -1, 1, 2, 2, 1}, dky[8] = {2, 1, -1, -2, -2, -1, 1, 2};

using namespace std;

vector<int> v{};
int n;
bool dp[101][100000+5]{};
int sum = 0;

void grid() {
	for (int i{}; i <= n; i++) {
		dp[i][0] = 1;
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= sum; j++) {
			if (j - v[i-1] >= 0) {
				dp[i][j] = dp[i-1][j] or dp[i-1][j - v[i-1]];
			} else {
				dp[i][j] = dp[i-1][j];
			}
		}
	}
	return;
}

int main(){
	cin >> n;
	
	for (int i{}; i < n; i++) {
		int a; cin >> a; v.pb(a);
		sum += a;
	}

	grid();

	int ans = sum/2;
	for (int i = ans; i >= 0; i--) {
		if (dp[n][i] == 1) break;
		ans--;
	}
	
	cout(sum-ans);
	
}
