n=gets.to_i
a=gets.split.map &:to_i
a.sort!
a.max
cnt=0
ary=[]
ary2=[]
ary2<<a[0]
(1..a.max).each do |i|
  (1..n).each do |j|
    cnt += 1 if a[j-1]%i == 0
    ary<<i if a[j-1]%i == 0
  end
  ary2 << i if ary.count(i)==n-1
end
puts ary2.max