n = gets.to_i
an = gets.split(' ').map{|a|a.to_i}

def factor(num)
  result = []
  2.upto((num/2).to_i) do | i |
    result << i if num % i == 0
  end
  return result
end

if an.size < 3
  p an.max
  exit
end

an.sort!
factors = []
factors = (factor(an[0]).push(factor(an[1]))).flatten.uniq.sort

max = 0
factors.each do | f |
  is_valid = 0
  an.each do | a |
    is_valid += 1 if a%f != 0
  end
  max = f if is_valid < 2
end
p max
nakasonomba:D