gcd' 1 _ = 1
gcd' n xs = if all (==0) $ map (`mod` n) xs then n else gcd' (n-1) xs

del :: Int -> [Int] -> [Int]
del i = reverse . foldl (\a (j,x) -> if i == j then a else x:a) [] . zip [0..]

main :: IO ()
main = do
    n <- readLn :: IO Int
    a <- map read . words <$> getLine :: IO [Int]
    let a' = map (flip del a) [0..n-1]
    print . maximum $ map (\i -> gcd' (minimum i) i) a'
