fn main() {
    let mut input = String::new();
    let mut stack: Vec<char> = Vec::new();
    std::io::stdin().read_line(&mut input).ok();
    let s = input.trim();
    for c in s.chars() {
        if c != '1' && c != '0' {
            continue;
        }
        // let _stack = &mut stack;
        match stack.last() {
            None => stack.push(c),
            Some(&l) => {
                if l == c {
                    stack.pop();
                } else {
                    stack.push(c);
                }
            }
        }
        // println!("{:?}", c);
        // println!("{:?}", stack);
    }

    println!("{}", s.len() - stack.len());
}
