main = do
  n <- readLn
  let l = length $ show n
  print $ f n l
  
f :: Int -> Int -> Int
f n 1 = length [1..n]
f n 2 = 9 
f n 3 = length [100..n] + 9 
f n 4 = 909 
f n 5 = 909 + length [10000..n]
f _ 6 = 90909 