const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split('\n');

while (line = lines.shift()) {
	const numberOfStudents = line.split(' ').map(Number);
    const nextLine = lines.shift();

    
    let scoreDiffFromStudent = [];

    if (nextLine !== undefined){
	    const scores = nextLine.split(' ').map(Number);
	    
	   for(let i = 0; i < numberOfStudents; i++) {
	   		let studentDiff = [];

		   	for (j = numberOfStudents-1; j >= 0; j--) {
		   		if (j != i){
		   			studentDiff.push(Math.abs(scores[i] - scores[j]));
		   		}
		    }

		    const smallestScore = Math.min.apply(null,studentDiff);
		    scoreDiffFromStudent.push(smallestScore);
	   }

	    console.log(Math.min(...scoreDiffFromStudent));
	}
}
