import java.util.*; import java.math.*; public class Main { private static Scanner sc = new Scanner(System.in); public static void main(String[] args) throws Exception { List list = new ArrayList<>(); int n = sc.nextInt(); for (int i = 0;i < n;i++) { list.add(sc.nextInt()); } Collections.sort(list); int ret = Integer.MAX_VALUE; int abs; for (int i = 1;i < n;i++) { abs = Math.abs(list.get(i)-list.get(i-1)); if (abs != 0) ret = Math.min(ret, abs); } ret = ret==Integer.MAX_VALUE?0:ret; System.out.println(ret); } }