N = int(input())
X = list(map(int,input().split()))

X.sort()
_min = 10 ** 7
for i in range(N-1):
    a = X[i+1]-X[i]
    if a > 0:
        if a < _min:
            _min = a
if _min == 10 ** 7:
    print(0)
else:
    print(_min)