import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); int N = Integer.parseInt(reader.readLine()); String[] inputs = reader.readLine().split(" "); long minDistance = Long.MAX_VALUE; boolean found = false; for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { long x = Long.parseLong(inputs[i]); long y = Long.parseLong(inputs[j]); if(x != y) { minDistance = Math.min(minDistance, Math.abs(x - y)); found = true; } } } if (found) { System.out.println(minDistance); } else { System.out.println(0); } } }