import sequtils, strutils, algorithm var n = readLine(stdin).parseInt x:seq[int] = readLine(stdin).split.map(parseInt) x = sorted(deduplicate(x), cmp[int]) if x.len < 2: echo -1 else: echo min(abs(x[0] - x[1]), abs(x[^1] - x[^2]))