import java.util.Arrays; import java.util.Scanner; public class No135 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int count = s.nextInt(); int[] pos = new int[count]; for (int i = 0; i < count; i++) { pos[i] = s.nextInt(); } pos = Arrays.stream(pos).distinct().sorted().toArray(); if (pos.length < 2) { System.out.println(0); return; } int min = Integer.MAX_VALUE; for (int i = 1; i < pos.length; i++) { int tmp = pos[i] - pos[i - 1]; if (min > tmp) { min = tmp; } } System.out.println(min); } }