N = int(input()) X = sorted(set(map(int, input().split()))) if len(X) < 2: print(0) else: z = 10**6 for i in range(len(X)-1): y = X[i+1] - X[i] z = min(z, y) print(z)