import java.util.Scanner; public class Main { public static void main(String[] args) { try { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int[] x = new int[N]; int ans = Integer.MAX_VALUE; x[0] = scan.nextInt(); for (int i = 1; i < N; ++i) { x[i] = scan.nextInt(); for (int j = i - 1; j > 0; --j) { if (x[i] != x[j]) { if (ans > Math.abs(x[i] - x[j])) { ans = Math.abs(x[i] - x[j]); } } } } if(ans == Integer.MAX_VALUE){ ans = 0; } System.out.println(ans); scan.close(); } catch (Exception e) { e.printStackTrace(); } } }