let () =
    let main () =
        let n = int_of_string (read_line ()) in
        let k = if n < 10 then n else
                if n < 1000 then 9 + max 0 (n - 99) else
                if n < 100000 then 909 + max 0 (n - 9999) else
                    90909
        in
        Printf.printf "%d\n" k
    in
    main ()