let () = Scanf.scanf "%d" @@ fun n ->
  let ans =
    if n <= 9 then n
    else if n <= 99 then 9
    else if n <= 999 then 9 + n - 99
    else if n <= 9999 then 909
    else 910
  in
  Printf.printf "%d" ans 