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

let ctr = 0;

while (line = lines.shift()) {
    if (ctr % 2 === 1) {
        const scores = Object.assign([], line.split(' ')
            .map(Number))
            .sort((l,r) => parseInt(l) - parseInt(r))

        const smallestGap = scores.slice(1).reduce((acc, curr, idx) => {
            const gap = Math.abs(curr - scores[idx]);
            return acc > gap ? gap : acc;
        }, 1000000)

        console.log(smallestGap);
    }
    ctr++
}

