import std.stdio, std.conv, std.string, std.range, std.math, std.algorithm; void main() { auto N = readln.strip.to!int; auto X = readln.split.to!(int[]); auto x = X.sort.uniq.array; (x.length < 2 ? 0 : 1000001.reduce!((a,b) => min(a,x[b]-x[b-1]))(1.iota(x.length))).writeln; }