getHalf :: [Int] -> [Int] getHalf l = drop (length l `div` 2) l makeList :: Int -> [Int] makeList 0 = [1] makeList x = makeList2 (makeList (pred x)) makeList2 :: [Int] -> [Int] makeList2 l | length l == 1 = l ++ [succ (last l)] | otherwise = l ++ makeList2 (getHalf l) solve :: Int -> [Int] solve x = [length l, sum l] where l = filter (== x) (foldr (++) [] (map makeList [0..30])) main :: IO () main = do x <- readLn let ans = solve x putStrLn $ show (head ans) ++ " " ++ show (last ans)