import           Data.List                      ( foldl' )

solve [l           ] [r           ] = [gcd l r]
solve (l0 : l1 : ls) (r0 : r1 : rs) = gcd l0 r1 : solve (l1 : ls) (r1 : rs)

main :: IO ()
main = do
    n  <- read <$> getLine :: IO Int
    as <- map read . words <$> getLine :: IO [Int]
    let ls = foldl' (\b a -> gcd (head b) a : b) [0] as
        rs = foldr (\a b -> gcd (head b) a : b) [0] as
        ms = solve (reverse ls) rs
    print (maximum ms)
