N = gets.to_i _ = gets.to_i n = Array.new(N) { gets.to_i } puts n.max - n.min