n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i).sort

if n == 2
  puts [a[0], a[1]].max
  exit
end

ans = 0
[[a[0], a[1]], [a[0], a[2]], [a[1], a[2]]].each do |arr|
  p = arr[1]
  q = arr[0]
  
  while p % q != 0
    r = p % q
    p = q
    q = r
  end
  
  next if r <= ans
  
  cnt = 0
  n.times do |i|
    cnt += 1 if a[i] % r != 0
  end
  
  ans = r if cnt <= 1
end

puts ans
