#include<bits/stdc++.h>
using namespace std;
int a[10010];
bitset <4001000> b;
int main()
{
	int n,sum=0;scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	sum=(sum+1)/2;
	b[0]=1;
	for (int i=1;i<=n;i++) b|=b<<a[i];
	for (int i=sum;;i++) if (b[i]) {printf("%d\n",i);return 0;}
}