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 = minimumBy (compare `on` (\i -> abs $ n2 - i)) xs'
  putStrLn $ unwords $ map show [n, r]
