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

#define MX1 2005
#define MX2 4000005
bitset<MX2>b_set;
int a[MX1],n;

bool solve(int x)
{
    b_set.reset();
    b_set.set(0);
    for(int i=0; i<n; i++)
    {
        b_set = b_set|(b_set<<a[i]);
    }
    return  (b_set.test(x));
}

int main()
{
    int i,x,s=0;
    scanf("%d",&n);
    for(i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
        s += a[i];
    }
    x = (s+1)>>1;
    for(i=x; i<=s; i++)
    {
        if(solve(i))
        {
            printf("%d\n",i);
            exit(0);
        }
    }
    return  0;
}
/// median >= (sum+1)/2
