function main(input) {
    var args = input.trim().split(" ");
    var N = args[0];

    var total = 0;
    if (N.length % 2 === 1) {
        var diff = (10**(N.length - 1));
        total = N - diff + 1;
    }

    var validDigit = Math.ceil((N.length - 1) / 2);
    for(var i = 1; validDigit + 1 > i; i++) {
        total += 10**(i * 2 - 2) * 9;
    }

    console.log(total);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));