"use strict";
const Main = (input) =>{
   let xs = input.trim().split('');
   let xs1 = input.trim().split(' '); 
   if(xs.length == 1){
   console.log(xs1[0]);
   }else if(xs.length == 2){
   console.log(9);
   }else if(xs.length == 3){
   console.log(xs1[0]-99 + 9);
   }else if(xs.length == 4){
   console.log(909);
   }else if(xs.length == 5){
   console.log(xs1[0]-9999 + 9);
   }else if(xs.length == 6){
   console.log(90909);
   }      
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));