#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#define ll long long
#define N 100005
#define inf 1000000005
#define mod 1000000007
#include <map>
#include <bitset>
#define put putchar('\n')
using namespace std;
inline int read(){char c=getchar();int tot=1;while ((c<'0'|| c>'9')&&c!='-') c=getchar();if (c=='-'){tot=-1;c=getchar();}
int sum=0;while (c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}return sum*tot;}
inline void wr(int x){if (x<0) {putchar('-');wr(-x);return;}if(x>=10)wr(x/10);putchar(x%10+'0');}
inline void wrn(int x){wr(x);put;}inline void wri(int x){wr(x);putchar(' ');}
int p,n,m,a,sum;
bitset<4000005> f;
int main(){
	//freopen(".in","r",stdin);freopen(".out","w",stdout);
	n=read();
	f[0]=1;
	for (int i=1;i<=n;i++){
		a=read();sum+=a;
		f|=f<<a;
	}
	p=(sum+1)/2;
	for (int i=(sum+1)/2;!f[i];i++)p=i+1;
	printf("%d",p);
	return 0;
}