#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<iomanip>
#include<regex>
using namespace std;
#define int long long
const int mod=1e9+7;
int dp[101][100001]={};
signed main(){
	int n,t[100];
	cin>>n;
	int sum=0;
	for(int i=0;i<n;i++){
		cin>>t[i];
		sum+=t[i];
	}
	dp[0][0]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<=sum;j++){
			dp[i+1][j]=dp[i][j];
			if(j>=t[i])
				dp[i+1][j]|=dp[i][j-t[i]];
		}
	}
	int ans=sum;
	for(int i=0;i<=sum;i++)
		if(dp[n][i])
			ans=min(ans,max(i,sum-i));
	cout<<ans<<endl;
}
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto e : v) os << e << ' '; return os; }
template <typename T> ostream &operator<<(ostream &os, const set<T> &v) { for (auto e : v) os << e << ' ';  return os; }
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &v) { for (auto e : v) os << e << ' ';  return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp) { for (auto e : mp) os << e << ' '; return os; }

template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } else return false; }
template <typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } else return false; }
inline bool in(int x, int y, int h, int w) { return 0 <= x && x < h && 0 <= y && y < w; }
inline void print() { cout << '\n'; }
template <typename T1, typename... T2> void print(const T1 a, const T2 &... b) { cout << a << ' '; print(b...); }

//#define DEBUG
#ifdef DEBUG
inline void debug_print() { cerr << endl; }
template <typename T1, typename... T2> void debug_print(const T1 a, const T2 &... b) { cerr << a << ' '; debug_print(b...); }
#define debug(...) cerr << __LINE__ << ": [" << #__VA_ARGS__ << "] = " , debug_print(__VA_ARGS__);
#else
#define debug(...) true
#endif

const int INF = (1<<30)-1;
const long long LINF = 1LL<<60;
const double EPS = 1e-9;
const int MOD = 1000000007;
//const int MOD = 998244353;
const int dx[8] = {-1,0,1,0,1,-1,1,-1};
const int dy[8] = {0,1,0,-1,1,-1,-1,1};

//-------------------------- Libraries --------------------------//

//--------------------------- Solver ----------------------------//

void solve() {
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];

    set<int> se;
    se.insert(a[0]);
    se.insert(-a[0]);
    for (int i = 1; i < N; i++) {
        set<int> tmp;
        for (auto &&e : se) {
            tmp.insert(e+a[i]);
            tmp.insert(e-a[i]);
        }
        se = tmp;
    }

    int d = INF;
    for (auto &&e : se) chmin(d, abs(e));

    int sum = 0;
    for (int i = 0; i < N; i++) {
        sum += a[i];
    }

    int ans = (sum+d)/2;

    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int t = 1;
    //cin >> t;
    while (t--) solve();

    return 0;
}
