#include <bits/stdc++.h>
#define ll long long
using namespace std;
bitset<4000010>b;
ll n,x,maxn;
int main()
{
	scanf("%d",&n);
	b[0]=1;
	while (n--)
	{
		scanf("%d",&x);
		b|=b<<x;
		maxn+=x;
	}
	ll i=0;
	for(i=(maxn+1)/2;!b[i];i++);
	printf("%d\n",i); 
	return 0;
}