local function getgcd(x, y)
  while 0 < x do
    x, y = y % x, x
  end
  return y
end
local n = io.read("*n")
local a = {}
for i = 1, n do
  a[i] = io.read("*n")
end
local left = {a[1]}
for i = 2, n - 1 do
  left[i] = getgcd(left[i - 1], a[i])
end
local right = {a[n]}
for i = n - 1, 2, -1 do
  right[n - i + 1] = getgcd(right[n - i], a[i])
end
local mmi, mma = math.min, math.max
local ret = mma(left[n - 1], right[n - 1])
for i = 1, n - 2 do
  local cand = getgcd(left[i], right[n - 1 - i])
  ret = mma(ret, cand)
end
print(ret)
