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

#define ll      long long
#define MAX1    2007
#define MAX2    4000007
#define inf     99999999999999
#define MOD     1000000007
#define pii     pair<int,int>
#define FIN     freopen("input.txt","r",stdin);
#define FOUT    freopen("output.txt","w",stdout);
#define pll     pair<ll,ll>
#define llu     unsigned long long

bitset<MAX2>b_set;
ll ara[MAX1];
ll n,sum=0;

void process()
{
    b_set.set(0);

    for(int i=0;i<n;i++)
    {
        b_set |= (b_set<<ara[i]);
        //actually the bitset shifts right
        //think like array
    }
}
int main ()
{
    scanf("%lld",&n);
    for(int i=0;i<n;i++)
        {
            scanf("%lld",&ara[i]);
            sum += ara[i];
        }
        process();
        ll mid = (sum + 1)>>1;
        for(ll i=mid;i<=sum;i++)
        {
            if(b_set.test(i))
            {
                printf("%lld\n",i);
                return 0;
            }
        }
    return 0;
}
