let solve x =
    let rec _solve x n i =
        if x >= i
        then _solve x ((n lsl 1) lor 1) (i + 1)
        else (n - 1) in
    _solve x 3 1

let () =
    let x = read_int () in
    print_int (solve x);
    print_newline ();;
