import Control.Monad
import Text.Printf
import Control.Applicative
import Data.List

main :: IO()
main = do
  n <- getLine
  x <- map read . words <$> getLine
  let (m, k) = slv x
  printf "%d %d\n" m k

slv :: [Integer] -> (Integer, Integer)
slv x = (maxx, truncate ((minimum ans) + middleVal))
  where maxx = maximum x 
        middleVal = (fromIntegral maxx) / (fromIntegral 2)
        ans = map (\l -> abs(realToFrac l - middleVal)) x

