#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define int ll
#define each(i, a) for (auto &&i : (a))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
using vd = vector<ld>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using P = pair<int, int>;
using vp = vector<P>;
using int128 = __int128_t;//cin coutはできない
template <class T>
using greater_queue = priority_queue<T, vector<T>, greater<T>>;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a / gcd(a, b) * b;};
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

template <class T>
void CVEC(const T &v) {
	int c = v.size() - 1;
	for (int i = 0; i < c; i++) cout << v[i] << ' ';
	if (c > -1) cout << v[c];
	cout << '\n';
}

#pragma endregion header

const int INF = 110110110;

signed main(){
    int n; cin >> n;
	vector<int> t(n);
	rep(i,n) cin >> t[i];
	int sum = accumulate(ALL(t), 0);
	vector<vector<int>> dp(110, vector<int>(100010, INF));
	dp[0][0] = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < 100010; j++){
			if(dp[i][j] != INF){
				dp[i + 1][j + t[i]] = min(dp[i + 1][j + t[i]], dp[i][j]);
				dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + t[i]);
			}
		}
	}
	int ans = INF;
	for(int j = 0; j < 100010; j++) ans = min(ans, max(j, dp[n][j]));
	cout << ans << endl;
}
#include <bits/stdc++.h>
using namespace std;

const int N = 105,M = 100005;

int f[N][M];//f[i][j] = 从1~i种中选，且总和正好为j的方案是否存在
int n;
int times[N];//烹饪时间

int main()
{
    ios::sync_with_stdio(0);
    cin>>n;

    int tot_time = 0;//总时间
    for(int i=1;i<=n;i++) cin>>times[i],tot_time+=times[i];
    

    for(int i=1;i<=n;i++)
    {
        f[i][times[i]] = 1;
        for(int j=times[i]+1;j<=tot_time;j++)
        {
            f[i][j] = max(f[i-1][j],f[i-1][j-times[i]]);
        }
    }

    int ans = 0x3f3f3f3f;
    for(int i=1;i<=n;i++)
    {
        for(int j=times[i];j<=tot_time;j++)
        {
            if(f[i][j]) ans = min(ans,max(j,tot_time-j));
        }
    }

    cout<<ans;

    return 0;
}

