import java.util.*; public class Run { public static void main (String arg[]) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); ArrayList X = new ArrayList<>(); for (int i = 0; i < N; i++) { X.add(scan.nextInt()); } Collections.sort(X); int min = X.get(1) - X.get(0); int tmp; for (int i = 1; i < N - 1; i++) { tmp = X.get(i+1) - X.get(i); if (tmp!=0 && (min==0 || tmp < min)) min = tmp; } System.out.println(min); } }