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


def gcd (m,n)
  r = m % n
  m1 = m
  n1 = n
  while r > 0
    m1 = n1
    n1 = r
    r = m1 % n1
  end
  return n1
end

if n == 2 
    p a.max
else
    cnt = 1
    first = [a[0]]
    last = [a[n-1]]
    for i in 1..n-2 do
        first.push(gcd(first[i-1],a[i]))
        last.push(gcd(last[i-1],a[n-i-1]))
    end
    max = first.pop
    b = last.pop
    if max < b
        max = b
    end
    for i in 1..first.size do
        c = gcd(first[i-1], last[-i])
        if max < c
            max = c
        end 
    end
    p max
end

