import Data.List

main = do
  n <- (readLn :: IO Int)
  a <- map (read :: String -> Int) . words <$> getLine
  print $ listgcdminus a

listgcd = foldl' gcd 0

listgcdminus [] = 0
listgcdminus [x] = 0
listgcdminus xs
  | gcdleft `rem` gcdright == 0 = gcd gcdleft (listgcdminus right)
  | gcdright `rem` gcdleft == 0 = gcd gcdright (listgcdminus left)
  | otherwise = max (gcd gcdleft (listgcdminus right)) (gcd gcdright (listgcdminus left))
    where
      i = length xs `div` 2
      left = take i xs
      right = drop i xs
      gcdleft = listgcd left
      gcdright = listgcd right