ar = Array.new n = gets.to_i n = gets.to_i while line = gets num = line.to_i ar.push(num) end ar = ar.sort.reverse puts ar[0] - ar[-1]