import java.util.Scanner; import java.util.Arrays; class No_135 { public static void main(String args[]) { Scanner stdIn = new Scanner(System.in); int num = stdIn.nextInt(); int x_axis[] = new int[num]; for (int i = 0; i < num; i++) { x_axis[i] = stdIn.nextInt(); } Arrays.sort(x_axis); int tmp_min = 100001; int result1, result2; for (int i = 1; i < num - 1; i++) { result1 = Math.abs( x_axis[i] - x_axis[i+1]); if ( result1 != 0 ) { if ( result1 < tmp_min ) { tmp_min = result1; } } result2 = Math.abs( x_axis[i] - x_axis[i-1]); if ( result2 != 0 && result2 < tmp_min ) { tmp_min = result2; } //tmp_min = (result1 < result2) ? result1 : result2; } if ( tmp_min == 100001 ) { System.out.println(0); } else { System.out.println(tmp_min); } } }