import java.util.Arrays; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] nu = new int[n]; for (int a_i = 0; a_i < n; a_i++) { nu[a_i] = in.nextInt(); } Arrays.sort(nu); int min = Math.abs(nu[0] - nu[1]); for (int i = 1; i < nu.length; i++) { min = Math.min(min, Math.abs(nu[i - 1] - nu[i])); } System.out.println(min); } }