def gcd_two(a, b) # assume b <= a
  return a if b % a == 0
  return gcd_two(b % a, a)
end

def gcd(arr) # arr: Array of non-negative integers
  if arr.size < 2
    raise "array (#{arr}) size is less than 2."
  end
  g = arr[0]
  for i in 1..arr.size - 1 do
    g = gcd_two([g, arr[i]].min, [g, arr[i]].max)
  end
  return g
end

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

arr = inputs[1]

# body
if $debugFlag
  p arr
end

nn = arr.size
ls = []
rs = []
(arr.size-1).times do |i|
  if i == 0
    ls << arr[0]
    rs << arr[nn-1]
  else
    ls << gcd_two(ls[i-1], arr[i])
    rs << gcd_two(rs[i-1], arr[nn - i - 1])    
  end
end

max = 0
curs = []
arr.size.times do |i|
  if i == 0
    curval = rs[nn-2]
  elsif i == nn - 1
    curval = ls[nn-2]
  else
    curval = gcd_two(ls[i - 1], rs[nn - i - 2])
  end
  max = curval if max < curval
  curs << curval
end

pd ls
pd rs
pd curs
puts max
