import Data.List main :: IO () main = interact $ unwords . map show . solve . map read . words solve :: [Int] -> [Int] solve (n:xs) | ix == 1 = if ((n * 4) - (head xs)) == 4 then [0, k] else [k, 0] | otherwise = yss where yss = reverse $ map length $ group $ sort xs ix = length yss k = head yss