#include<bits/stdc++.h>
#include<chrono>
using namespace std;

#define FASTio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int 
#define all(v) (v).begin(), (v).end()
#define getunique(v) {sort(all(v)); v.erase(unique(all(v)), v.end());}
#define printarr(v) {for(auto x : v) cout<<x<<" ";cout<<"\n";}
#define mp make_pair
#define pb push_back
#define pf push_front
#define ff first
#define ss second
#define lcm(a, b) ((a) * (b)) / __gcd(a, b)
#define umpit unordered_map<ll,ll>::iterator
#define mpit map<ll,ll>::iterator
#define setit set<ll>::iterator
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
const ll INF = LLONG_MAX / 2;
#define PI 3.1415926535897932384626433832795
#define mod 1000000007

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // designed by Sebastiano Vigna and found on Neal's blog
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    // unordered_map<int,int,custom_hash> M;
};

int main()
{
   FASTio;
    #ifndef ONLINE_JUDGE                    //file start
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);   
    #endif                                  //file end
    ll t=1,i,j;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        vector<ll>arr(n);
        for(i=0;i<n;i++)
            cin>>arr[i];
        ll ans = 0;
        ll sum = accumulate(all(arr),0ll);
        vector<vector<bool>>dp(n+1,vector<bool>(sum+1,false));
        for(i=0;i<=n;i++)
            dp[i][0] = true;
        for(i=1;i<=sum;i++)
            dp[0][i] = false;

        
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=sum;j++)
            {
                dp[i][j] = dp[i-1][j];
                if(arr[i-1] <= j)
                    dp[i][j] = dp[i][j] | dp[i-1][j-arr[i-1]];
            }
        }
        for(i=(sum+1)/2;i<=sum;i++)
        {
            if(dp[n][i])
            {
                ans = i;
                break;
            }    
        }
            
        cout<<ans<<"\n";
    }
    return 0;
}
#include <bits/stdc++.h>
 
using namespace std; 
 
#define int long long 
 
template <typename T> 
void print_vec(const vector<T>& v, bool newline = true) {
    for (int i = 0; i < v.size(); ++i) {
        cout << v[i] << " ";
    }
    if (newline) {
        cout << "\n";
    }
}
 
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 
 
const int maxn = (int)2e5+105;
const int mod = (int)998244353 ; 
 
#define sz(x) ((int)(x.size()))
 
#define pb push_back
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
 
using vi = vector<int>;
 
int fact_setup=0; int * fact; 
 
int ex (int a, int b){
    if(b==0)return 1; int e = ex(a,b/2); e=(1ll*e*e)%mod; if(b&1)e=(1ll*e*a)%mod; return e;
}
int inv (int a){
    return ex(a, mod - 2); 
}
int choose (int a, int b){
    if(!fact_setup){
        fact_setup=1; 
        fact = new int [maxn]; 
        fact[0]=1; rep (i,1,maxn-1) fact[i]=(i*fact[i-1])%mod; 
    }
    if(a<b)return 0; 
    int num = fact[a]; 
    int denom = (fact[b] * fact[a - b]) % mod; 
    return (num * inv(denom)) % mod; 
}
 
#define pii pair <int, int> 
#define pvi pair <vector <int>, int> 
 
#define pai array <int,2>
#define pdi array <double, 2> 
#define pdt array <double, 3>
 
#define pti array <int,3>
#define pfi array <int,4>
 
#define all(v) v.begin(), v.end()

bool pos [maxn], pos2[maxn]; 
int t[maxn]; 
main(){
    cin.tie(0); ios_base::sync_with_stdio(0); 
	int n; cin >> n; 
	int tot=0; 
	rep (i,1,n){cin>>t[i]; tot+=t[i];}
	pos[0] = 1; 
	rep (i,1,n){
		memset(pos2,0,sizeof(pos2)); 
		rep (j,0,maxn-1){
			if(pos[j]) pos2[j+t[i]]=pos2[abs(j-t[i])]=1; 
		}
		rep (j,0,maxn-1)pos[j]=pos2[j]; 
	}
	rep (j,0,maxn-1){
		if (pos[j]){
			cout<<(tot-j)/2 + j << '\n'; return 0; 
		}
	}
	
    return 0; 
}
