import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { final int constraint1 = 2; final double constraint2 = Math.pow(10,5); final double constraintAI = Math.pow(-10,9); final double constraintAI2 = Math.pow(10,9); Scanner in = new Scanner(System.in); int n; do{ n = in.nextInt(); }while( n <= constraint1 && n >= constraint2); int[] a = new int[n]; for(int a_i=0; a_i < n; a_i++){ a[a_i] = in.nextInt(); } int currentSmallestDiff =Math.abs(a[0]- a[1]); int smallestDiff =0; int lastNum = n; for(int a_i=1;a_i<= n;a_i++) { if( a_i == lastNum) { smallestDiff = Math.abs(a[0]- a[lastNum-1]); } else { smallestDiff = Math.abs(a[a_i-1]- a[a_i]); } if( smallestDiff< currentSmallestDiff) { currentSmallestDiff = smallestDiff; } } System.out.println(currentSmallestDiff); } }