n = gets.to_i

values = gets.split.map(&:to_i)



def gcd(array)
  lastvalue = 0
  array.each do |num|
    lastvalue = num.gcd(lastvalue)
  end
  lastvalue
end

reslist = []
count = 0
n.times do
  list = values.dup
  list.delete_at(count)
  reslist.push(gcd(list))
  count += 1
end

p reslist.max