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(); List set = new ArrayList(); // int[] a = new int[n]; for(int a_i=0; a_i < n; a_i++){ set.add((in.nextInt())); } Collections.sort(set); int smallest=Integer.MAX_VALUE; Iterator iter=set.iterator(); int a=(int)iter.next(); while(iter.hasNext()){ int b=(int)iter.next(); int difference=Math.abs(a-b); if(smallest>difference){ smallest=difference; if(smallest==0) break; } a=b; } System.out.println(smallest); } }