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

a.last.downto(2) do |i|
  cnt = 0
  for o in a
    if o % i != 0
      cnt += 1
      if cnt > 1
        break
      end
    end
  end

  if cnt <= 1
    p i
    break
  end
end
