local ior = io.read
local n = ior("*n")
local a = {}
for i = 1, n do a[i] = io.read("*n") end

local function getgcd(x, y)
  while(0 < x and 0 < y) do
    if(x < y) then y = y % x else x = x % y end
  end
  return math.max(x, y)
end

local mac = math.ceil
local mam = math.max

local groups = mac(n / 1000)
local groupgcd = {}
local group_inv_gcd = {}
for i = 1, groups do
  groupgcd[i] = 0
  group_inv_gcd[i] = 0
end

for i = 1, n do
  local g = mac(i / 1000)
  groupgcd[g] = getgcd(groupgcd[g], a[i])
end

for i = 1, groups do
  for j = 1, groups do
    if(i ~= j) then
      group_inv_gcd[i] = getgcd(group_inv_gcd[i], groupgcd[j])
    end
  end
end

local ret = 0

for i = 1, n do
  local g = mac(i / 1000)
  local stt = 1 + (g - 1) * 1000
  local last = (g == groups and n or g * 1000)
  local cand = group_inv_gcd[g]
  for j = stt, last do
    if(j ~= i) then
      cand = getgcd(cand, a[j])
    end
  end
  ret = mam(ret, cand)
end
print(ret)
