N = int(input()) X = list(set(map(int, input().split()))) ans = abs(X[0] - X[-1]) for i in range(len(X)): for j in range(i+1, len(X)): ans = min(ans, abs(X[i] - X[j])) print(ans)