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(); int[] x = new int[n]; for (int i = 0; i < n; i++) { x[i] = sc.nextInt(); } Arrays.sort(x); if (x[0] == x[n-1]) { System.out.println(0); return; } 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]); } } System.out.println(min); } }