#!/usr/bin/env ruby

n = gets.chomp.to_i
ary = gets.chomp.split(' ').map(&:to_i)

def max(a, b)
  a > b ? a : b
end

right_gcd = []
ary.each_with_index do |num, index|
  right_gcd[index] = if index.zero?
                       num
                     else
                       right_gcd[index - 1].gcd(num)
                     end
end

left_gcd = []
ary.reverse.each_with_index do |num, index|
  left_gcd[index] = if index.zero?
                      num
                    else
                      left_gcd[index - 1].gcd(num)
                    end
end
left_gcd = left_gcd.reverse

ans = 0

0.step(n - 1) do |i|
  if i == 0
    ans = max(ans, left_gcd[i + 1])
  elsif i == n - 1
    ans = max(ans, right_gcd[i - 1])
  else
    max = max(ans, right_gcd[i - 1].gcd(left_gcd[i + 1]))
  end
end

puts ans
