_ = int(input()) points = sorted(set(map(int, input().split()))) dist = [points[n + 1] - points[n] for n in range(len(points) - 1)] if dist: print(min(dist)) else: print(0)