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