#include<cstdio>
#include<iostream>
#include<bitset>
using namespace std;
int n,i,x,y;
bitset<4000010> a;
int main()
{
	scanf("%d",&n);
	a[0]=1;
	for(i=1;i<=n;i++)
	{
		scanf("%d",&x);
		y+=x;
		a|=a<<x;
	}
	if(y&1)y=y/2+1;else y/=2;
	while(a[y]==0)y++;
	printf("%d\n",y);
}