n = gets.to_i x = gets.split.map(&:to_i).sort.uniq min = Float::INFINITY 0.upto(x.size - 2) do |i| min = x[i + 1] - x[i] if x[i + 1] - x[i] < min end puts min == Float::INFINITY ? 0 : min