import java.util.Scanner; class No_135 { public static void main(String args[]) { Scanner stdIn = new Scanner(System.in); int num = stdIn.nextInt(); int vc[] = new int[num]; for (int i = 0; i < num; i++) { vc[i] = stdIn.nextInt(); } System.out.println(vc_Length(vc, num)); } public static int vc_Length(int vc[], int num) { int tmp = 1000000; for (int i = 0; i < num; i++) { for (int k = 0; k < num; k++) { if (i == k) { continue; } if (vc[i] == vc[k]) { continue; } if (tmp > Math.abs(vc[i] - vc[k])) { tmp = Math.abs(vc[i] - vc[k]); } else { continue; } } } return tmp; } }