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