#include <iostream>
#include <bitset>
using namespace std;
bitset<4000005> dp;
int main()
{
	int n,sum=0;
	scanf("%d",&n);
	dp[0]=1;
	while (n--)
	{
		int a;
		scanf("%d",&a);
		dp|=(dp<<a);
		sum+=a;
	}
	int ans=(sum+1)/2;
	while (!dp[ans])
	ans++;
	printf("%d",ans);
}