import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int abs_diff = Integer.MAX_VALUE; private static int checkMinAbsDiff(List a) { // TODO Auto-generated method stub if(a.size() == 0) return 0; int new_diff; Collections.sort(a); for(int i = 0; i < a.size() - 1; i++){ new_diff = Math.abs(a.get(i) - a.get(i + 1)); if(new_diff < abs_diff) abs_diff = new_diff; } return abs_diff; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; List my_list = new ArrayList(); for(int a_i=0; a_i < n; a_i++){ a[a_i] = in.nextInt(); my_list.add(a[a_i]); } // your code goes here System.out.println(checkMinAbsDiff(my_list)); in.close(); } }