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

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

