var lines = require("fs").readFileSync("/dev/stdin","utf-8").split("\n");
var N = parseInt(lines[0]);
var A = lines[1].split(" ").map((item)=>parseInt(item));
var answer = 0;
for(var i=0;i<A.length;i++){
	for(var j=0;j<A.length;j++){
		var abs = Math.abs(A[i]-A[j]);
      	if(answer<abs) answer = abs;
    }
}
console.log(answer);