N = int(input()) X = list(map(int, input().split())) SX = sorted(set(X)) D = [SX[i+1] - SX[i] for i in range(len(SX)-1) ] print(min(D))