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

while (line = lines.shift()) {
    const numbers = line.split(' ').map(Number);
    let length = numbers[0];
    let arr = numbers.slice(1,length+1);
    let min; 
    let min2;
    for(let i = 0; i<length; i++){
    if(arr[i] > arr[i+1]){
        min2 = arr[i] - arr[i+1];
    } else {
        min2 = arr[i+1] - arr[i];
    }

    if(i == 0){
        min = min2;
        continue;
    } 

    if(min > min2) min = min2;
    }


    console.log(min);
}
