import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class No_166 { static int shortestDistance(ArrayList list, int i1, int i2, int m) { int num1 = (int) list.get(i1); int num2 = (int) list.get(i2); int min = m; if (num1 != num2) { min = Math.min(m, Math.abs(num1 - num2)); } if (i2 >= list.size() - 1) { return min; } else { return shortestDistance(list, ++i1, ++i2, min); } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList list = new ArrayList(); int n = sc.nextInt(); for (int i = 0; i < n; i++) { list.add(sc.nextInt()); } Collections.sort(list); int ans = shortestDistance(list, 0, 1, Integer.MAX_VALUE); System.out.println(ans); sc.close(); } }