main = do
    n <- readLn
    xs <- map (read::String -> Int) . words <$> getLine
    print $ maximum (func n (take (n * 2 - 2) $ cycle xs))

func :: Int -> [Int] -> [Int]
func n (x:xs) = if n <= length xs + 1
                    then foldr1 gcd (take n xs):func n xs
                    else []

