import Data.List import Data.Ord main :: IO () main = do n <- read <$> getLine as <- map read . words <$> getLine putStrLn $ unwords $ map show $ solve n as solve :: Int -> [Int] -> [Int] solve n as = if all (\n' -> n' == (head as)) as then if (head as) `div` (n-1) == 2 then [n,0] else [0,n] else counter n as counter :: Int -> [Int] -> [Int] counter n as = [length (head gc), length (last gc)] where kame_counts = sortOn Down (map (other_kame n) as) gc = group kame_counts other_kame :: Int -> Int -> Int other_kame n t = (t - (n - 1) * 2) `div` 2