let n = int (stdin.ReadLine())
let ln = n.ToString().Length
let a = if ln % 2 = 1 then n + 1 - (pown 10 (ln - 1)) else 0
printfn "%d" <| a + ([for i in 1..2..ln - 1 -> (pown 10 (i - 1)) * 9] |> List.sum)