import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); TreeSet set = new TreeSet<>(); for (int i = 0; i < n; i++) { set.add(sc.nextInt()); } if (set.size() == 0) { System.out.println(0); } int prev = Integer.MIN_VALUE / 10; int min = Integer.MAX_VALUE; for (int x : set) { min = Math.min(min, x - prev); prev = x; } System.out.println(min); } }