function Main(input) {
  var n = parseInt(input);
  var k = Math.floor(Math.log10(n)); // 10^k≦nを満たす最大のk
  var sum = 0;
  for(var i=1; i<=k; i+=2){
  	sum += Math.pow(10, (i-1))*9;
  }
  if(k%2==0){
  	sum += n-Math.pow(10, Math.floor(Math.log10(n))) + 1;
  }
  console.log(sum);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));