import java.io.*; import java.util.*; import java.math.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); // Initialize our array of numbers int n = in.nextInt(); List array = new ArrayList<>(n); // Read in our array from the input for (int i = 0; i < n; i++) array.add(in.nextInt()); // Sort the numbers in the array, smallest to largest array.sort(null); // Find and output the distance of the smallest "gap" between adjacent numbers int minDifference = Integer.MAX_VALUE; for (int i = 0; i < n - 1; i++) { int difference = Math.abs(array.get(i) - array.get(i + 1)); if (difference < minDifference) minDifference = difference; } System.out.println(minDifference); } }