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[]) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String readLine = br.readLine(); int[] array = Arrays.stream(br.readLine().split(" ")) .mapToInt(x->Integer.parseInt(x)) .sorted() .toArray(); int min = array[1]-array[0]; for (int i = 2 ; i != array.length ; i++) { min = Math.min(min, array[i]-array[i-1]); } System.out.println(min); } }