package sample; 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); int first = x[0]; //int i = 1; 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); } }