import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int []X = new int[N]; for(int i = 0; i < N; i++) { X[i] = scan.nextInt(); } scan.close(); if(X.length == 0) { System.out.println("0"); System.exit(0); } Arrays.sort(X); int k = 0; for(int i = 0; i < N - 1; i++) { if(X[i] == X[i + 1]) { k ++; }else { break; } } if(k == N - 1) { System.out.println("0"); System.exit(0); } int ans = X[k] - X[k + 1]; if(ans < 0) { ans = - ans; } int temp = 0; for(int i = k + 1; i < N - 1; i++) { int x1 = X[i]; int x2 = X[i + 1]; temp = x1 - x2; if(temp != 0) { if(temp < 0) { temp = - temp; } if(ans > temp) { ans = temp; } } } System.out.println(ans); } }