def msort(x): result = [] if len(x) < 20: return sorted(x) mid = int(len(x) / 2) y = msort(x[:mid]) z = msort(x[mid:]) i = 0 j = 0 while i < len(y) and j < len(z): if y[i] > z[j]: result.append(z[j]) j += 1 else: result.append(y[i]) i += 1 result += y[i:] result += z[j:] return result def abs(n): if n<0: return -n else: return n #main N = long(raw_input().strip()) L1 = map(long, raw_input().strip().split(' ')) L = msort(L1) mind = abs(L[1]-L[0]); for i in range (2, N): mind = min(mind, abs(L[i]-L[i-1])) print mind