n = gets.to_i _ = gets a = [] n.times do a << gets.to_i end p a.max - a.min