import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static int getMinimumDifference(int ... numbers){ int minimumDifference = Integer.MAX_VALUE, temp = 0; for(int i = 0; i < numbers.length; i++){ if(i < numbers.length-1){ int[] subArray = Arrays.copyOfRange(numbers, i+1, numbers.length); for(int j = 0; j < subArray.length; j++){ temp = Math.abs(numbers[i]-subArray[j]); } if(temp < minimumDifference){ minimumDifference = temp; } } } return minimumDifference; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; for(int a_i=0; a_i < n; a_i++){ a[a_i] = in.nextInt(); } // your code goes here System.out.println(getMinimumDifference(a)); } }