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;
    }

    // i番目のbitを1にする
    void set(size_t i) {
        _data[i>>6] |= 1UL<<(i&63);
    }

    // i番目のbitを0にする
    void reset(size_t i) {
        _data[i>>6] &= ~(1UL<<(i&63));
    }

    // 全てのbitを0にする
    void resetAll() {
        _data[] = 0;
    }

    // i番目のbitを反転させる
    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;

            if (offset == 0) {
                return lhs;
            }

            auto ofs_arr = offset >> 6;
            auto ofs_bit = offset & 63;

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

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

                lhs._data[0 .. ofs_arr] = 0;
            }
            
            return lhs;
        }
        else static if (op == ">>") {
            auto lhs = this;

            if (offset == 0) {
                return lhs;
            }

            auto ofs_arr = offset >> 6;
            auto ofs_bit = offset & 63;

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

                lhs._data[lhs._size - ofs_arr - 1] = lhs._data[lhs._size - 1] >> ofs_bit;
                lhs._data[lhs._size - ofs_arr .. $] = 0;
            }
            else {
                foreach (i ; 0 .. lhs._size - ofs_arr) {
                    lhs._data[i] = lhs._data[i + ofs_arr];
                }

                lhs._data[lhs._size - ofs_arr .. $] = 0;
            }

            return lhs;
        }
    }

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

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

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

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

            _data[_size - ofs_arr - 1] = _data[_size - 1] >> ofs_bit;
            _data[_size - ofs_arr .. $] = 0;
        }
    }
    

    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;
        return format("[%(%b, %)]", array);
    }
}

Measured memory_bytes: 4348