use std::io::{read_to_string, stdin};

fn main() {
    let temp = read_to_string(stdin()).unwrap();
    let mut iter = temp
        .split_ascii_whitespace()
        .map(|x| x.parse::<usize>().unwrap());

    let n = iter.next().unwrap();
    let weights = {
        let mut v = (0..n).map(|_| iter.next().unwrap()).collect::<Vec<_>>();
        v.sort();
        
        v
    };

    // we can make the range [min(S), sum(S)]
    let mut res = 0;
    let mut cum = 0;
    for &w in weights.iter() {
        if cum + 1 < w {
            res = cum + 1;
            break;
        }
        cum += w;
    }

    if res == 0 {
        res = cum + 1;
    }

    println!("{}", res);
}
