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 a = new ArrayList<>(); for(int a_i=0; a_i < n; a_i++){ a.add(in.nextInt()); } a.sort(Comparator.naturalOrder()); int min = Integer.MAX_VALUE; for(int i = 0; i < a.size()-1; i++) { int abs = Math.abs(a.get(i) - a.get(i+1)); if (abs < min) { min = abs; } } System.out.println(min); } }