n = int(input()) x = [int(i) for i in input().split()] x.sort() dist = [] for i in range(n-1): dist.append(x[i+1]-x[i]) print(min(dist))