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 k = 0; k < num - 1; k++) { for (int j = 0; j < num; j++) { if ( k + j > num - 1 ) { continue; } if ( vc[k] == vc[k+j] ) { continue; } if (tmp >= Math.abs(vc[k] - vc[k+j])) { tmp = Math.abs(vc[k] - vc[k+j]); } } } return tmp; } }