#include<bits/stdc++.h>
using namespace std;
const int M=2005;
int n,x,sum;
bitset<M*M>dp;
void in(){scanf("%d",&n);}
void ac()
{
    dp[0]=1;
    for(int i=1;i<=n;++i)scanf("%d",&x),dp|=dp<<x,sum+=x;
    for(int i=sum+1>>1;i<=sum;++i)if(dp[i])printf("%d",i),exit(0);
}
int main(){in();ac();}