#include<bits/stdc++.h>
#define N 2005
#define M 4000005
using namespace std;
int n,a[N],S;
bitset<M> F;
int main()
{
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]),S+=a[i];
	sort(a+1,a+n+1);
	F[0]=1;
	for(i=1;i<=n;i++)
		F|=(F<<a[i]);
	for(i=S/2;i>=0;i--)
		if(F[i]) break;
	cout<<S-i;
	return 0;
}
