inputs = Array.new
while line = $stdin.gets
  inputs << line.chomp
end

N = inputs[0]
As = inputs[1].split(" ").map(&:to_i)

def getGCDAll(as, excludeIndex: -1)
  gcd = nil
  as.each.with_index do |a, index|
    next if index == excludeIndex
    if !gcd
      gcd = a
      next
    end
    gcd = gcd.gcd(a)
    return 1 if gcd == 1
  end
  gcd
end

# 除く数を求める
def getRejectedIndex(as)
  # 互いに素な数を見つける
  tmp = as.min
  tmp_index = -1;
  as.each_with_index do |a, index|
    tmp_index = index if tmp == a
  end
  as.each_with_index do |a, index|
    # 互いに素の場合、a or tmp のどちらかが reject される数
    return [tmp_index, index] if a % tmp != 0
  end
  # 全て 互いに素でない場合は 最小の数が除かれる数
  return [tmp_index]
end

rejctedIndexes = getRejectedIndex(As)

gcds = rejctedIndexes.map do |index|
  getGCDAll(As, excludeIndex: index)
end

res = gcds.max
puts res
