import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); int N = Integer.parseInt(reader.readLine()); String[] inputs = reader.readLine().split(" "); long[] points = new long[N]; for (int i = 0; i < N; i++) { points[i] = Long.parseLong(inputs[i]); } Arrays.sort(points); long minDistance = Long.MAX_VALUE; boolean found = false; for (int i = 1; i < N; i++) { if(points[i] != points[i-1] ) { found = true; minDistance = Math.min(minDistance, Math.abs(points[i] - points[i-1])); } } if (found) { System.out.println(minDistance); } else { System.out.println(0); } } }