import Data.List
import Text.Printf

main = do
  _ <- getLine
  as <- map read . words <$> getLine::IO[Int]
  let [n, r] = solve as
  printf "%d %d\n" n r 


solve as =
  [n, r]
  where
    r = minimumBy (\x y -> compare (abs $ n'-x) (abs $ n'-y)) as
    n = maximum as
    n' = div n 2
    