import Data.List
import Data.Char
import Data.Maybe
import qualified Data.ByteString.Char8 as BS8

dig_impl 0 r = r
dig_impl n r = dig_impl (div n 10) (r + 1)

dig n = dig_impl n 0

cnt n r
    | n < 10 = r
    | (mod (dig n) 2) == 1 = cnt (div n 10) (r - (9 * 10 ^ (dig n - 2))) + 1
    | otherwise = cnt (div n 10) (r - (n - 10 ^ (dig n - 1))) - 1

main :: IO ()
main = do
    n <- fst . fromJust . BS8.readInteger <$> BS8.getLine

    print $ cnt n n
