#include<bits/stdc++.h>
#define For(i,j,k) for(int i=j;i<=k;++i)
#define Forr(i,j,k) for(int i=j;i>=k;--i)
#define ll long long 
using namespace std;
const int N=2010,INF=0x3f3f3f3f;
template<class T>void read(T &x){
	x=0;char c=getchar();
	while(!isdigit(c))c=getchar();
	while( isdigit(c))x=x*10+c-48,c=getchar();
}
int n,a[N];
inline void file(){
	freopen("will.in","r",stdin);
	freopen("will.out","w",stdout);
}
void init(){
	read(n);
	For(i,1,n)read(a[i]);
}
bitset<N*N>dp[2];
int main(){
	//file();
	init();
	int sum=0,now=0,pre=1,s=0;
	dp[1][0]=1;
	For(i,1,n){
		s+=a[i];
		dp[now]=dp[pre]|(dp[pre]<<a[i]);
		dp[pre].reset(0);swap(now,pre);
	}
	sum=s/2+1;
	For(i,0,s){
		if(dp[pre][i]&1)sum--;
		if(!sum){
			printf("%d\n",i);break;
		}
	}
	return 0;
}
