import qualified Data.ByteString.Char8 as B
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  n <- readLn
  as <- getInts
  print $ solve n as

solve :: Int -> [Int] -> Int
solve _ = maximum . calcGCDs

calcGCDs :: [Int] -> [Int]
calcGCDs as = map (uncurry gcd') $ zip ls (tail rs) where
  ls = scanl gcd 0 as
  rs = scanr gcd 0 as

gcd' :: Int -> Int -> Int
gcd' 0 b = b
gcd' a 0 = a
gcd' a b = gcd a b

readInts :: B.ByteString -> [Int]
readInts = map (fst . fromJust . B.readInt) . B.words

getInts :: IO [Int]
getInts = readInts <$> B.getLine
