count = gets.to_i
head = []
tail = []

nums = gets.split.map(&:to_i)

nums.each{|n|
    head.push(head.empty? ? n : head.last.gcd(n))
}

nums.reverse_each{|n|
    tail.push(tail.empty? ? n : tail.last.gcd(n))
}

tail.reverse!
last_index = count - 1

puts (0..last_index).map{|index|
    if index == 0
        tail[1]
    elsif index == last_index
        head[last_index -1]
    else
        head[index - 1].gcd(tail[index + 1])
    end
}.max