import java.io.*; import java.util.*; import java.math.*; class Main135 { public static void out (Object out) { System.out.println(out); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int ans = Integer.MAX_VALUE; int n = Integer.parseInt(br.readLine()); String[] line = br.readLine().split(" "); ArrayList list = new ArrayList(); for (int i = 0; i < n; i++) { int m = Integer.parseInt(line[i]); if (!list.contains(m)) list.add(m); } Collections.sort(list); for (int i = 1; i < list.size(); i++) { ans = Math.min(ans , list.get(i) - list.get(i - 1)); } out(list.size() == 1 ? 0 : ans); } }