import qualified Data.ByteString.Char8 as B
import           Data.List             (inits, tails)
import           Data.Maybe            (fromJust)

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

solve :: Int -> [Int] -> Int
solve _ as = maximum [foldr1 gcd (xs ++ ys) | (xs, _:ys) <- zip (init (inits as)) (init (tails as)) ]

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

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