n = gets().to_i
a = gets().split(' ').map(&:to_i)

def ag(l)
  ln = l.length
  if ln == 1
    return l[0]
  end
  b = []
  for i in 0..(l.length / 2 - 1)
    b.push(l[i << 1].gcd(l[(i << 1) + 1]))
  end
  if ln % 2 == 1
    b.push(l[ln - 1])
  end
  b.uniq!
  return ag(b)
end

c = []
for i in 0..(n-1)
    na = a.clone
    na.delete_at(i)
    c.push(ag(na))
end
  
print(c.max)