require 'pp'
require 'prime'

N = readline.to_i
A = readline.chomp.split.map(&:to_i)

count = Hash.new(0)

p0 = Hash[ A[0].prime_division ]
p1 = Hash[ A[1].prime_division ]
p0.each do |k,v|
  v.times do |e|
    count[ [k,e+1] ] += 1
  end
end
#pp count
p1.each do |k,v|
  v.times do |e|
    count[ [k,e+1] ] += 1
  end
end
#pp count

(2..(N-1)).each do |i|
  a = A[i]
  ks = count.keys
  ks.each do |p,e|
    d = p**e
    if a % d != 0
      k = [p,e]
      count[k] -= 1
      count.delete(k) if count[k] == 0
    end
  end
end
# pp count

def make_div(keys)
  ans = Hash.new(0)
  keys.each do |p,e|
    ans[p] = e if ans[p] < e
  end
  ans
end

h = make_div(count.keys).to_a

$cand = []
def dfs(h, i, x)
  if i == h.size
    $cand << x
    return
  end
  (h[i][1]+1).times do |v|
    dfs(h, i+1, x * (h[i][0]**v))
  end
end

dfs(h, 0, 1)
    
# pp $cand

puts $cand.select {|c|
  count = 0
  A.each do |a|
    if a % c != 0
      count += 1
      break if count == 2
    end
  end
  count < 2
}.max

