{-# 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 + 1)) | i <- [0 .. n - 1] ]
 where
  -- [a0,a0-a1,a0-a2,...,a0-a(n-1)]
  leftmost = VU.fromList $ (0 :) $ reverse $ foldl'
    (\(a:acc) i -> gcd (hs VU.! i) a : a : acc)
    [hs VU.! 0]
    [1 .. n - 1]

  -- [a(n-1),a(n-1)-a(n-2),...,a(n-1)-a1]
  rightmost = VU.fromList $ (++ [0]) $ foldl'
    (\(a:acc) i -> gcd (hs VU.! i) a : a : acc)
    [hs VU.! (n - 1)]
    (reverse [0 .. n - 2])

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
