_=gets.split.map(&:to_i)
a=gets.split.map(&:to_i)

a2=a.group_by(&:itself).select{|k,v|v.size==1}.map{|k,v|k}


if(a2.size==0 || a.size==1) 
    p a.reduce(:gcd)
else
    r=a2.min_by{|x| x.gcd(a2[0])}
    p [a.select {|x| x!=r}.reduce(:gcd) , a.drop(1).reduce(:gcd) ].max
    
end
