{-# OPTIONS_GHC -O2 #-}
import Data.Function
import Data.List

comb n r
  | r == 0 = ((n,0),1)
  | n == r = ((n,r),1)
  | otherwise = ((n,r), snd (comb (n-1) (r-1)) + snd (comb (n-1) r))

f :: Int -> [Int] -> IO (Int, Int)
f n xs = pure . fst $ maximumBy (compare `on` snd) [comb x y | x <- xs, y <- xs, x > y]

main = do
  n <- readLn
  xs <- (map read . words) <$> getLine
  (a,b) <- f n xs
  putStrLn $ show a ++ ' ': show b