input() X = sorted(set(map(int, input().split()))) if len(X) < 2: print('0') else: print(min(b - a for a, b in zip(X, X[1:])))