import Data.List
import Data.Function
import Control.Monad
import Control.Applicative

main = do
  _ <- getLine
  xs <- sort <$> map read <$> words <$> getLine :: IO [Int]
  --let xs = sort [6,9,4,2,11]
  let n = last xs
  let xs' = init xs
  let n2 = (n `div` 2)
  let r = if (length xs' > 1)
          then minimumBy (compare `on` (\i -> n2 - i)) [last $ takeWhile (n2 >) xs', head $ dropWhile (n2 >) xs']
          else head xs'
  putStrLn $ unwords $ map show [n, r]
