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 = 1000001; int x=0; for(int i = 1; i < n-1; i++){ if(point[i]!=point[i+1]){ x = Math.abs(point[i]-point[i+1]); min = Math.min(x,min); } } return (min==1000001)?0:min; } }