object Main{
 
def main(args: Array[String]): Unit = {
  val arr1 = io.StdIn.readLine().split(' ')
      val n = arr1(0).toInt

      val baseN = math.log10(n).toInt // x^n
      val ten = math.pow(10, baseN) // 一番左の桁
      val under = n - ten // 一番左の桁以外

      var count = (0 to baseN + 1 by 2).map{
        i =>
         val v = math.pow(10, i+1) - math.pow(10, i) 
        v
      }.sum
  
  	  if(baseN % 2 == 0){
      	count += (under + 1)
      }

      println(count)
}
}