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

min_num = 100001
choosable = False
for i, Xi in enumerate(X):
    n = 0
    if i > 0:
        n = Xi - X[i-1]
    if n!=0 and min_num > n:
        choosable = True
        min_num = n

if choosable and N != 1:
    print(min_num)
else:
    print(0)