import java.util.*; 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 ans = Integer.MAX_VALUE; for(int i = 1; i < N; i++) { if(x[i] > x[i - 1]) ans = Math.min(ans, x[i] - x[i - 1]); } if(ans == Integer.MAX_VALUE) ans = 0; System.out.println(ans); } }