def gcb(x, y)
  if y == 0
    return x
  end
  mod = x % y
  mod == 0 ? y : gcb(y, mod)
end

gets
nums = gets.split(' ').map{|n| n.to_i}
p (0 .. nums.size - 1)
  .to_a
  .map{|i|
    r = nums[0 .. i - 1].reduce{|a, b| gcb(a,b)}
    l = nums[i + 1 .. nums.size].reduce{|a, b| gcb(a,b)}
    defined = [r, l].select{|n| !n.nil?}
    if defined.size == 2
      gcb(r, l)
    elsif defined.size == 1
      defined[0]
    else
      nil
    end
  }
  .max
