import java.util.Scanner; import java.util.Set; import java.util.TreeSet; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Set set = new TreeSet(); int n = sc.nextInt(), a = -1000000, min = 1000001; for(int i = 0; i < n; i++){ set.add(sc.nextInt()); } if(set.size() == 1){ System.out.println(0); return; } for(int i : set){ min = Math.min(min, i-a); a = i; } System.out.println(min); } }