import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as C

readInt' = fst.fromJust.C.readInt
readLnInt = map readInt'.C.words<$>C.getLine
readCsInt n = concat<$>replicateM n readLnInt

x ? (a,b) = if x then a else b
half = flip div 2
aliq = ((0==).).mod

main = do
 [n] <- readLnInt
 print $ solve n

solve n
 | n<10 = n
 | n<1000 = 9+f[n,100]
 | n<100000 = 909+f[n,10000]
 | otherwise = 90909
 
f :: [Int] -> Int
f[n,p]= (n<p)?(0,n-p+1)
