fun main(args: Array<String>) {
    val input = readLine()!!.toInt()

    val ans = when (input.toString().length){
        1 -> input
        2 -> 9
        3 -> input - 99 + 9
        4 -> 909
        5 -> input - 9999 + 909
        6 -> 90909
        else -> 0
    }
    print(ans)
}