import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); // int[] a = new int[n]; ArrayList a=new ArrayList(); for(int a_i=0; a_i < n; a_i++){ a.add(in.nextLong()); } // your code goes here Collections.sort(a); /* Initialize difference between two consecutive numbers to zero */ long minimum = 1000000000L; for(int i = 0;i<(n-1); i++){ long temp = Math.abs(a.get(i+1)-a.get(i)); if (temp <= minimum) minimum = temp; } /* Return the minimum difference */ System.out.println(minimum); } }