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