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 _ = maximum . map calcGCD . slice

-- >>> slice "abc"
-- [("", "bc"), ("a", "c"), ("ab", "")]
slice :: [a] -> [([a], [a])]
slice as = [(xs, ys) | (xs, _:ys) <- zip (init (inits as)) (init (tails as)) ]

calcGCD :: ([Int], [Int]) -> Int
calcGCD ([], ys) = gcdAll ys
calcGCD (xs, []) = gcdAll xs
calcGCD (xs, ys) = gcd (gcdAll xs) (gcdAll ys)

gcdAll :: [Int] -> Int
gcdAll = foldr1 gcd

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

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