#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
const int MAX = 2e5;

int main(){
  int n;
  cin >> n;
  int t[n];
  int st = 0;
  rep(i,n) {
    cin >> t[i];
    st += t[i];
  }
  vector<int> dp(MAX);
  dp[0] = 1;
  rep(i,n) {
    vector<int> dpn(MAX);
    rep(j,MAX) {
      if(dp[j]) dpn[j]++;
      if(j+t[i] < MAX and dp[j]) dpn[j+t[i]]++;
    }
    swap(dp,dpn);
  }
  int ans = MAX;
  rep(i,MAX) {
    if(dp[i]) ans = min(ans,max(i,st-i));
  }
  cout << ans << endl;
}
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define N 105
#define M 100001
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
	return x*f;
}
int n,a[N],sum;
bool f[2][200003];
int main()
{
	n=read();
	for(int i=1;i<=n;i++) a[i]=read(),sum+=a[i];
	int x=1,y=0;
	f[x][M+0]=1;
	for(int i=1;i<=n;++i)
	{
		memset(f[y],0,sizeof(f[y]));
		for(register int j=-100000;j<=100000;++j)
		    if(f[x][M+j]) f[y][M+j+a[i]]=f[y][M+j-a[i]]=1;
		swap(x,y);
	}
	for(int i=0;i<=100000;++i)
	    if(f[x][M+i] || f[x][M-i]){printf("%d\n",(sum+i)/2);return 0;}
	return 0;
}