N = int(input()) X = sorted(set(map(int, input().split()))) Z = float('inf') for i in range(len(X)-1): Y = X[i+1] - X[i] Z = min(Y, Z) print(Z)