n = gets.to_i
A = gets.split.map(&:to_i)
N = A.size

def gcd(a, b)
  if b == 0
    return a
  end

  gcd(b, a % b)
end

map = Hash.new(0)
(N - 1).times do |i|
  (i + 1).upto(N - 1) do |j|
    map[gcd(A[i], A[j])] += 1
  end
end

map.keys.sort.reverse.each do |k|
  if map[k] >= N - 2
    puts k
    exit
  end
end
