import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import Data.List

solve :: Int -> [Int] -> (Int,Int)
solve n as = (p, q)
  where
    p:ps = sortOn (* (-1)) as
    (_, q) = minimum $ map g ps
      where g a = (f a, a)
            f a | p `mod` 2 == 1 = abs (((p + 1) `div` 2) - a)
                | 2 * a <= p     = p `div` 2 - a
                | otherwise      = a - ((p `div` 2) + 1)

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> (Int,Int)
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_n]:remLines1 = remLines0
      n = readBInt bs_n
      line2:remLines2 = remLines1
      as = map readBInt line2
  in solve n as

outAnswer :: (Int,Int) -> IO ()
outAnswer (x,y) = putStrLn $ unwords $ map show [x,y]

main :: IO ()
main = outAnswer . tmain =<< B.getContents
