import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!int).array;

    BitArray dp;
    dp.length = 2000*2000;

    foreach (a; A) {
        auto dp2 = dp.dup;
        dp2 <<= a;
        dp |= dp2;
        dp[a] = true;
    }

    int ans = A.sum/2 + A.sum%2;
    while (!dp[ans]) ++ans;
    ans.writeln;
}
