import Data.List main = do n <- readLn as <- map read . words <$> getLine putStrLn $ unwords $ map show $ tsurukame n as tsurukame n as@(a:_) | equiv as && a+2 == sumf = [0,n] | equiv as && a+4 == sumf = [n,0] | otherwise = map length $ group $ sort as where sumf = div (sum as) (n-1) equiv xs = and $ zipWith (==) xs (tail xs)