public class No_166 { public static void main(String[] args) { java.util.Scanner sc = new java.util.Scanner(System.in); int n = sc.nextInt(); int[] X = new int[n]; int distance = Integer.MAX_VALUE; for (int i = 0; i < n; i++) { X[i] = sc.nextInt(); } java.util.Arrays.sort(X); for (int i = 0; i < X.length - 1; i++) { if (X[i] == X[i + 1]) { continue; } distance = Math.min(distance, Math.abs(X[i] - X[i + 1])); } if (distance != Integer.MAX_VALUE) { System.out.println(distance); } else { System.out.println(0); } sc.close(); } }