function Main(input){
var N = new Number(input);
var Np = input.split("");
var count = 0;
switch(Np.length){
  case 1:
    count += new Number(Np[0]);
    console.log(count);
  break;
  case 2:
    count += 9;
    console.log(count);
  break;
  case 3:
    count += new Number(N)-90;
    console.log(count);
  break;
  case 4:
    count += 909;
    console.log(count);
  break;
  case 5:
    count += new Number(N)-9000;
    console.log(count);
  break;
  case 6:
    count += 90909;
    console.log(count);
  break;
  default:
    console.log("error");
  break; 

}
}
  Main(require('fs').readFileSync('/dev/stdin','utf8'));