import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Data.Char

solve :: Int -> VU.Vector Int -> Int
solve n xs = VU.maximum $ VU.map comp (VU.fromList [0..n-1])
    where
        left = VU.scanl gcd 0 xs
        right = VU.scanr gcd 0 xs
        comp x = gcd (left VU.! x) (right VU.! (x+1))

main = do
    n <- readLn :: IO Int
    xs <- VU.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine 
    print $ solve n xs