import Control.Applicative
import Data.List
import Control.Monad


main = do
    n <- read <$> getLine :: IO Int
    xs <- map read.words <$> getLine :: IO [Int]
    putStrLn.format $ foldl g (0,0,0) $ map (f xs) xs where
        g (m,a,b) (x,y,z) = if x > m then (x,y,z) else (m,a,b)

format (_,a,b) = show a ++ " " ++ show b

f xs v = foldl g (0,0,0) xs' where
    xs' = filter ((>) v) $ delete v xs
    g (m,a,b) k = if c v k > m then (c v k,v,k) else (m,a,b)

c _ 0=1
c n k=c(n-1)(k-1)*n`div`k