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