a=gets.to_i b=gets c=[] a.times do |i| c[i] = gets.to_i end p c.max-c.min