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