Main(require("fs").readFileSync("/dev/stdin", "utf8"));

function Main(input) {


	Array.prototype.max = function() { return Math.max.apply(null, this) }
	Array.prototype.min = function() { return Math.min.apply(null, this) }
	num = (val) => Array.isArray(val) ? val.map( (v)=>Number(v) ) : Number(val)
	print = console.log

	var line = input.split("\n")
	var n = num( line[0] )
	var a = num( line[1].split(" ") )

	print( a.max() - a.min() )

}