import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); if(N == 1) System.out.println("0"); int[] x = new int[N]; for(int i = 0; i < N; i++) { x[i] = sc.nextInt(); } int MIN = Integer.MAX_VALUE; for(int i = 0; i < N; i++) { for(int j = i + 1; j < N; j++) { if(x[i] == x[j]) continue; MIN = Math.min(MIN, (int)Math.abs(x[i] - x[j])); } } if(MIN == Integer.MAX_VALUE) MIN = 0; System.out.println(MIN); } }