# AtCoder Beginner Contest 064_B

min = 1000;	max = 0

#input n
n = gets.to_i

#make array
array = []

n.times do |i|
	array[i] = gets.to_i
	if array[i] > max 
		max = array[i]
	end
	if min > array[i]
		min = array[i] 
	end
end

puts max - min
