fun main(args: Array<String>) {
    val N = Integer.parseInt(readLine())
    var result = 0
    if (N <= 9) {
        result = N
    } else if (N <= 99) {
        result = 9
    } else if (N <= 999) {
        result = 9 + (N - 99)
    } else if (N <= 9999) {
        result = 909
    } else if (N <= 99999) {
        result = 909 + (N - 9999)
    } else {
        result = 90909
    }

    println(result)
}