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

void main() {
    int n;
    int[] a;

    scan(n);
    a = readln.split.to!(int[]);

    auto bs = bitSet(n * a.reduce!max + 1);
    bs.set(0);

    foreach (ai ; a) {
        bs |= bs << ai;
    }

    int s = a.sum();

    foreach (i ; (s + 1) / 2 .. s + 1) {
        if (bs[i]) {
            writeln(i);
            return;
        }
    }
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


struct bitSet {
    // 64-bit (64 = 2^6)

    private {
        // _N : 要素数
        // _size : N/64 の切り上げ
        size_t _size, _N;
        ulong[] _data;
    }

    this (size_t N) {
        _N = N;
        _size = (_N + 63) / 64;
        _data = new ulong[](_size);
    }

    // bool[]による初期化
    this (bool[] arr) {
        _N = arr.length;
        _size = (_N + 63) / 64;
        _data = new ulong[](_size);

        foreach (i ; 0 .. _size) {
            foreach (j ; 0 .. 64) {
                if ((i<<6) + j >= _N) return;
                if (arr[(i<<6) + j]) {
                    _data[i] |= 1UL<<j;
                }
            }
        }
    }

    this (this) {
        _N = _N;
        _size = _size;
        _data = _data.dup;
    }

    void set(size_t i) {
        _data[i>>6] |= 1UL<<(i&63);
    }

    void unset(size_t i) {
        _data[i>>6] &= ~(1UL<<(i&63));
    }

    void flip(size_t i) {
        _data[i>>6] ^= 1UL<<(i&63);
    }

    bitSet opBinary(string op)(const bitSet rhs) {
        import std.algorithm : min;

        static if (op == "&") {
            auto lhs = this;
            foreach (i ; 0 .. min(lhs._size, rhs._size)) {
                lhs._data[i] &= rhs._data[i];
            }
            return lhs;
        }
        else static if (op == "|") {
            auto lhs = this;
            foreach (i ; 0 .. min(lhs._size, rhs._size)) {
                lhs._data[i] |= rhs._data[i];
            }
            return lhs;
        }
        else static if (op == "^") {
            auto lhs = this;
            foreach (i ; 0 .. min(lhs._size, rhs._size)) {
                lhs._data[i] ^= rhs._data[i];
            }
            return lhs;
        }
    }

    void opOpAssign(string op)(const bitSet rhs) {
        import std.algorithm : min;

        static if (op == "&") {
            foreach (i ; 0 .. min(_size, rhs._size)) {
                _data[i] &= rhs._data[i];
            }
        }
        else static if (op == "|") {
            foreach (i ; 0 .. min(_size, rhs._size)) {
                _data[i] |= rhs._data[i];
            }
        }
        else static if (op == "^") {
            foreach (i ; 0 .. min(_size, rhs._size)) {
                _data[i] ^= rhs._data[i];
            }
        }
    }

    bitSet opBinary(string op)(const size_t offset) {
        static if (op == "<<") {
            auto lhs = this;

            auto ofs_arr = offset>>6;

            foreach_reverse (i ; 0 .. lhs._size) {
                if (i < ofs_arr) {
                    lhs._data[i] = 0;
                }
                else {
                    lhs._data[i] = lhs._data[i - ofs_arr];
                }
            }

            auto ofs_bit = offset&63;

            foreach_reverse (i ; 1 .. lhs._size) {
                lhs._data[i] = (lhs._data[i]<<ofs_bit) | ((lhs._data[i-1] & (((1UL<<ofs_bit)-1)<<(64-ofs_bit)))>>(64-ofs_bit));
            }

            lhs._data[0] <<= ofs_bit;

            return lhs;
        }
        else static if (op == ">>") {
            auto lhs = this;

            auto ofs_arr = offset>>6;

            foreach (i ; 0 .. lhs._size) {
                if (i + ofs_arr >= lhs._size) {
                    lhs._data[i] = 0;
                }
                else {
                    lhs._data[i] = lhs._data[i + ofs_arr];
                }
            }

            auto ofs_bit = offset&63;

            foreach (i ; 0 .. lhs._size - 1) {
                lhs._data[i] = (lhs._data[i]>>ofs_bit) | ((lhs._data[i+1]&((1UL<<ofs_bit)-1))<<(64-ofs_bit));
            }

            lhs._data[$-1] >>= ofs_bit;

            return lhs;
        }
    }

    void opOpAssign(string op)(const size_t offset) {
        static if (op == "<<") {
            auto ofs_arr = offset>>6;

            foreach_reverse (i ; 0 .. _size) {
                if (i < ofs_arr) {
                    _data[i] = 0;
                }
                else {
                    _data[i] = _data[i - ofs_arr];
                }
            }

            auto ofs_bit = offset&63;

            foreach_reverse (i ; 1 .. _size) {
                _data[i] = (_data[i]<<ofs_bit) | ((_data[i-1] & (((1UL<<ofs_bit)-1)<<(64-ofs_bit)))>>(64-ofs_bit));
            }

            _data[0] <<= ofs_bit;
        }
        else static if (op == ">>") {
            auto ofs_arr = offset>>6;

            foreach (i ; 0 .. lhs._size) {
                if (i + ofs_arr >= lhs._size) {
                    _data[i] = 0;
                }
                else {
                    _data[i] = _data[i + ofs_arr];
                }
            }

            auto ofs_bit = offset&63;

            foreach (i ; 0 .. lhs._size - 1) {
                _data[i] = (_data[i]>>ofs_bit) | ((_data[i+1]&((1UL<<ofs_bit)-1))<<(64-ofs_bit));
            }

            _data[$-1] >>= ofs_bit;
        }
    }
    

    bool opIndex(size_t index) in {
        assert(0 <= index && index < _N);
    }
    body {
        return !!(_data[index>>6] & (1UL<<(index&63)));
    }

    bool[] array() {
        bool[] res = new bool[](_N);

        foreach (i ; 0 .. _size) {
            foreach (j ; 0 .. 64) {
                if ((i<<6) + j < _N) {
                    res[(i<<6) + j] = !!(_data[i] & (1UL<<j));
                }
            }
        }

        return res;
    }

    string toString() {
        import std.format : format;
        /+
        string res = "[";

        foreach_reverse (i ; 0 .. _size) {
            foreach_reverse (j ; 0 .. 64) {
                if (_N <= 64*i + j) continue;
                res ~= cast(char)('0' + !!(_data[i] & (1L<<j)));
                res ~= ", ";
            }
        }

        res = res[0 .. $-2];
        res ~= "]";
        +/

        return format("[%(%b, %)]", array);
    }
}

Measured memory_bytes: 4348