n = int(input()) num = [ int(v) for v in input().split() ] num.sort() num2 = [0] + [ num[i+1] - num[i] for i in range(n - 1) ] print(min(num2))