main = readLn >>= putStrLn . unwords . map show . sequence [fact2, pred] fact2 x = length fs2 + (fo - 1) where (fs2,[fo]) = span (==2) (fact2' x) fact2' x | odd x = [x] | otherwise = 2 : fact2' (div x 2)