#include <bits/stdc++.h>

using namespace std;

#define ll           long long int
#define vint         vector<int>
#define vll          vector<ll>
#define vstr         vector<string>
#define vvint        vector<vector<int> >
#define vvll         vector<vector<ll> >
#define vip          vector<pair<int,int> >
#define vlp          vector<pair<ll,ll> >
#define input(arr)   for(auto &x:arr) cin>>x;
#define all(x)       (x).begin(), (x).end()
#define rall(x)      (x).rbegin(), (x).rend()

const int N = 100005;
const ll mod = 1000000007;
const ll inf = 1e17;
const long double pi = (acos(-1));

bool csort(const pair<int,int>&a, const pair<int,int>&b){
    return a.second < b.second;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n; cin>>n;
    vint arr(n); input(arr);
    int sum = accumulate(all(arr),0);
    vector<vector<bool>> dp(n+1, vector<bool>(sum+1,false));
    for(int i=0;i<=n;++i)
        dp[i][0] = true;
    for(int i=1;i<=n;++i){
        for(int j=1;j<=sum;++j){
            if(j<arr[i-1])
                dp[i][j] = dp[i-1][j];
            else
                dp[i][j] = dp[i-1][j] || dp[i-1][j-arr[i-1]];
        }
    }
    int i = sum/2 + (sum&1);
    //cout<<i<<endl;
    while(i<=sum && (!dp[n][i])){
        ++i;
    }
    cout<<i;
}

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
int n;
int a[105],dp[105][100005];
int main(){
    cin>>n;
    int sum=0;
    for(int i=1;i<=n;i++)cin>>a[i],sum+=a[i];
    dp[0][0]=1;
    for(int i=0;i<n;i++)
     for(int j=0;j<=sum;j++){
        if(dp[i][j]){
        	dp[i+1][j]=1;
        	dp[i+1][j+a[i+1]]=1;
		}
	 }
	 for(int i=(sum%2==0)?(sum/2):(sum/2+1);i<=sum;i++)
	 if(dp[n][i]){
	 	cout<<i;
	 	break;
	 }
	return 0;
}