num = int(input()) points = list(set(map(int, input().split()))) points.sort() dist = [abs(points[n] - points[n + 1]) for n in range(len(points) - 1)] print(min(dist))