package m.shin; import java.util.Scanner; import java.util.TreeSet; public class Con135 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt(); TreeSet x = new TreeSet<>(); for(int i = 0;i < N;i++){ x.add(s.nextInt()); } s.close(); int from = x.pollFirst() , to = 0; if(x.size() == 0){ System.out.println("0"); }else{ int dmin = Math.abs(x.last() - from) , size = x.size(); for(int i = 0;i < size;i++){ to = x.pollFirst(); if(dmin > Math.abs(to - from)){ dmin = Math.abs(to - from); } from = to; } System.out.println(dmin); } } }