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(); Long[] input = new Long[n]; for(int a_i=0; a_i < n; a_i++){ input[a_i] = in.nextLong(); } List ordered = Arrays.asList(input); Collections.sort(ordered); Long minDif = Long.MAX_VALUE; for (int i = 0; i < ordered.size()-1; i++) { minDif = Math.min(Math.abs(ordered.get(i)-ordered.get(i+1)), minDif); } System.out.println(minDif); } }