N = gets.to_i X = gets.split.map(&:to_i).sort.uniq puts X.size == 1 ? 0 : X.each_cons(2).map{|a,b| (a - b).abs}.min