def gcd(_num1, _num2)
  if _num1<0
  	_num1*=-1
  end
  if _num2<0
  	_num2*=-1
  end
  while _num2 > 0
   _num1,_num2=_num2,_num1%_num2
  end
  return _num1
end

def ngcd(_list)
  num = 0
  _list.each{ |a|
    num = gcd(num, a)
  }
  return num
end
n=gets.to_i
a=gets.chomp.split(" ").map(&:to_i)
list_gcd=[]
n.times do|i|
	list=[]
	counter=0
	n.times do|j|
		if i==j
			next
		end
		list[counter]=a[j]
		counter+=1
	end
	list_gcd[i]=ngcd(list)
end
print list_gcd.max