loop = gets.to_i points = gets.split.map(&:to_i).uniq if points.length < 2 puts 0 return end dist = (points[0] - points[1]).abs for i in 0...(points.length - 1) xi = points[i] for j in (i+1)...(points.length) xj = points[j] dist = (xi - xj).abs if dist > (xi - xj).abs end end puts dist