import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; import java.util.TreeSet; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); TreeSet set = new TreeSet(); for(int i = 0; i < N; i++){ set.add(sc.nextInt()); } ArrayList list = new ArrayList(set); int min = Integer.MAX_VALUE; for(int i = 0; i < list.size() - 1; i++){ min = Math.min(min, Math.abs(list.get(i) - list.get(i + 1))); } if(min == Integer.MAX_VALUE){ min = 0; } System.out.println(min); } }