#include<bits/stdc++.h>
using namespace std;
const int N=2e3+5;
bitset<N*N>b;
int n,a[N],i,s,ss;
int main(){
	b[0]=1;
	scanf("%d",&n);for(i=1;i<=n;++i)scanf("%d",a+i),b|=b<<a[i];
	for(i=1;i<N*N;++i)s+=b[i];
	for(i=1;ss+=b[i],ss<s+1>>1;++i);printf("%d\n",i);
}