import java.util.*; public class liner{ public static void main(String... args){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); if(n==1){ System.out.println(0); return; } int[] point = new int[n]; for(int i = 0; i < n; i++){ point[i] = scan.nextInt(); } Arrays.sort(point); System.out.println(result(point,n)); } public static int result(int[] point,int n){ int min = 100001; if(n==2)return min; for(int i = 0; i < n-1; i++){ if(point[i+1]-point[i] < min && point[i+1]-point[i] > 0){ min = point[i+1]-point[i]; } } return min; } }