import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.stream.Stream; public class No00000135_Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] arr = Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); Arrays.sort(arr); boolean first = true; int dis = 0; for(int i = 1; i < n; i++) { if(arr[i - 1] != arr[i]) { if(first) { first = false; dis = Math.abs(arr[i] - arr[i - 1]); } dis = Math.min(dis, Math.abs(arr[i] - arr[i - 1])); } } System.out.println(dis); } }