import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int array[] = new int[n]; StringTokenizer st = new StringTokenizer(br.readLine()); for(int i = 0;i < n;i++){ array[i] = Integer.parseInt(st.nextToken()); } Arrays.sort(array); int ans = Integer.MAX_VALUE; for(int i = 1;i < n;i++){ ans = Math.min(ans,Math.abs(array[i] - array[i - 1])); } System.out.print(ans); } }