import std.stdio, std.string, std.conv; import std.algorithm, std.array; import core.stdc.stdlib; void main(){ auto s = readln.strip.to!int; int[] arr = readln.strip.split.map!(to!int).array; if(s == 1){0.writeln;exit(-1);} arr.sort; int ans, before; ans = arr[1] - arr[0]; foreach(i, x; arr){ if(before == x || i == 0) continue; if(ans > x - before){ ans = x - before; } before = x; } writeln(ans); }