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
(n-1).times do |j|
  p = a[j+1]
  q = a[j]
  r = q

  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
