import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int []arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = in.nextInt(); } Arrays.sort(arr); int minDiff = (int) Math.abs(arr[1] - arr[0]);; for (int i = 1; i < n; i++) { int absDiff = (int) Math.abs(arr[i] - arr[i - 1]); if (absDiff < minDiff) { minDiff = absDiff; } } System.out.println(minDiff); } }