import java.io.*; import java.util.*; class Main135 { public static void out (Object o) { System.out.println(o); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String[] line = br.readLine().split(" "); int[] nums = new int[n]; for (int i = 0; i < n; i++) nums[i] = Integer.parseInt(line[i]); int ans = Integer.MAX_VALUE; Arrays.sort(nums); for (int i = 1; i < n; i++) { int sub = nums[i] - nums[i - 1]; if (sub != 0 && sub < ans) ans = sub; } out(ans); } }