#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>
ostream &operator<<(ostream &os, const vector<T> &x){
    os << "{";
    for(size_t i = 0; i < x.size(); i++){
        if(i < x.size()-1) os << x[i] << ", ";
        else os << x[i];
    }
    os << "}";
    return os;
}

int main(void){
    int n;
    cin >> n;
    vector<int> t(n);
    rep(i, n) cin >> t[i];
    vector<unordered_map<int, int>> dp(n+1);
    dp[0][0] = 1;
    const int INF = 1e5;

    rep(i, n){
        for(int j = -INF; j <= INF; j++){
            if(dp[i][j] == 0) continue;
            if(j-t[i] >= -INF) chmax(dp[i+1][j-t[i]], dp[i][j]);
            if(j+t[i] <= INF) chmax(dp[i+1][j+t[i]], dp[i][j]);
        }
    }
    int ans = INF;
    for(int j = -INF; j <= INF; j++){
        if(dp[n][j] == 1) chmin(ans, abs(j));
    }
    int sum = 0;
    rep(i, n) sum+=t[i];
    ans = (ans+sum)/2;
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

std::vector<std::string> split(const std::string& source, const char delim);

int main(){
    std::string buffer;
    std::getline(std::cin, buffer);
    const int NUM_DISH = std::stoi(buffer);

    std::getline(std::cin, buffer);
    auto splitCostTime = split(buffer, ' ');
    std::vector<int> costTimeList;
    for(const auto& costTime : splitCostTime){
        costTimeList.emplace_back(std::stoi(costTime));
    }

    std::array<std::unique_ptr<int[]>, 101> dp;
    for(int i = 0; i < NUM_DISH + 1; ++i){
        dp[i] = std::make_unique<int[]>(101010);
        for(int t = 0; t < 101010; ++t){
            dp[i][t] = INT_MAX;
        }
    }
    dp[0][0] = 0;
    for(int i = 0; i < NUM_DISH; ++i){
        for(int t = 0; t < 101010; ++t){
            if(dp[i][t] != INT_MAX){
                chmin(dp[i + 1][t + costTimeList[i]], dp[i][t]);
                chmin(dp[i + 1][t], dp[i][t] + costTimeList[i]);
            }
        }
    }

    int ans = INT_MAX;
    for(int t = 0; t < 101010; ++t){
        chmin(ans, std::max(t, dp[NUM_DISH][t]));
    }
    std::cout << ans << std::endl;

    return 0;
}

std::vector<std::string> split(const std::string& source, const char delim){
    std::vector<std::string> splitData;
    std::stringstream sstream(source);
    std::string itemBuffer;

    while(std::getline(sstream, itemBuffer, delim)){
        splitData.emplace_back(itemBuffer);
    }

    return splitData;
}