import Data.List

solver::[Int]->(Int,Int)
solver ls = let m:m':rest = sortBy (\ x -> \ y -> compare y x ) ls in
            if div m 2 == 0 then (m,find_even m m' rest)
                            else (m,find_odd  m m' rest)

--max list stored
find_even::Int -> Int -> [Int] -> Int
find_even m now [] = now
find_even m now (x:rest) = if (abs (x - (div m 2))) <= (abs (now - (div m 2)))
                              then find_even m x rest
                              else find_even m now rest

find_odd ::Int -> Int -> [Int] -> Int
find_odd m now []  = now
find_odd m now (x:rest) = if (min (abs (x - (div (m+1) 2))) (abs (x - (div (m-1) 2)))) <= (min (abs (now - (div (m+1) 2))) (abs (now - (div (m-1) 2))))
                              then find_odd m x rest
                              else find_odd m now rest

main::IO()
main=do
  _<-getLine
  d<-getLine
  let dat = map read (words d)
  let (a,b) = solver dat
  putStr ((show a)++" "++(show b)++"\n")