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

p = a[1]
q = a[0]
r = q

while p % q != 0
  r = p % q
  p = q
  q = r
end

cnt = 0
n.times do |i|
  cnt += 1 if a[i] % r != 0
end

ans = r if cnt <= 1 && r > ans


p = a[2]
q = a[0]
r = q

while p % q != 0
  r = p % q
  p = q
  q = r
end

cnt = 0
n.times do |i|
  cnt += 1 if a[i] % r != 0
end

ans = r if cnt <= 1 && r > ans


p = a[2]
q = a[1]
r = q

while p % q != 0
  r = p % q
  p = q
  q = r
end

cnt = 0
n.times do |i|
  cnt += 1 if a[i] % r != 0
end

ans = r if cnt <= 1 && r > ans


puts ans
