n = int(input()) x = list(map(int, input().split())) x.sort() y = [] for i in range(n-1): d = abs(x[i+1] - x[i]) if d > 0: y.append(d) print(min(y))