{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Foldable
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Debug.Trace

solve :: Int -> VU.Vector Int -> Int
solve n hs = maximum
  [ gcd (leftmost VU.! i) (rightmost VU.! i) | i <- [0 .. n - 1] ]
 where
  gcds      = VU.foldl1 gcd

  leftmost  = VU.fromList (0 : [ gcds $ VU.take i hs | i <- [1 .. n - 1] ])
  rightmost = VU.fromList ([ gcds $ VU.drop i hs | i <- [1 .. n - 1] ] ++ [0])

main = do
  let readInt = fmap (second B.tail) . B.readInt

  n  <- (\vec -> (vec VU.! 0)) . VU.unfoldrN 1 readInt <$> B.getLine
  hs <- VU.unfoldrN n readInt <$> B.getLine
  print $ solve n hs
