function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.split(" ");
	input = input.split("\n");
	//input = input.split(" ").map((a)=>Number(a));
	//input = input.split("\n").map((a)=>Number(a));
  var list = input[1].split(" ").map((a)=>Number(a));
  myout(Math.max.apply(null,list) - Math.min.apply(null,list));
}

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