let n=Int(readLine()!)!
if 1<=n && n<=9{
  print(n)
}else if 101<=n && n<=999{
  print(9+n-100)
}else if 1001<=n && n<=9999{
  print(9+899+n-1000)
}else if 10001<=n && n<=99999{
  print(9+899+8999+n-10000)
}
