import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); Integer[] x = new Integer[n]; for (int i = 0; i < n; i++) { x[i] = sc.nextInt(); } Arrays.sort(x); int min = Integer.MAX_VALUE; for (int i = 0; i < n - 1; i++) { if (0 < (x[i + 1] - x[i])) { min = Math.min(min, x[i + 1] - x[i]); } } if (min == Integer.MAX_VALUE) { min = 0; } System.out.println(min); } }