n = gets.chomp.to_i
alist = gets.chomp.split.collect{ |item| item.to_i}
alist.sort!


def gcd(a,b)
  gcd(b, a) if b > a
  return b if (r = a % b).zero?
  gcd(b, r)
end
minisize = 3
if n <= minisize
  resultlist = []
  n.times do |nn|
    out = alist.shift
    newresult = alist[0]
    (n-1).times do |nnn|
      newresult = gcd(newresult,alist[nnn])
    end
    resultlist.push(newresult)
    alist.push(out)
  end
  puts resultlist.max

else # n>10

  gcddata = 1
  result = 1
  n.times do |skipn|
    newresult = 1
    skip = alist[skipn]
    start = skipn+1
    gcddata = gcd(gcddata,alist[skipn-1])
    start.upto(n-1) do |nnn|
      newresult = 1
      if skipn == 0
        newresult = alist[1]
      elsif skipn == 1
        newresult = alist[0]
        gcddata = alist[0]
      else
        newresult = gcddata
      end
      newresult = gcd(newresult,alist[nnn])
      break if newresult <= result
    end
    result = newresult if newresult > result
    #alist.insert(nn,out)
  end

  puts result
end