N = int(input()) X = sorted(list(map(int, input().split()))) ans = [] for i in range(N-1): if abs(X[i] - X[i+1]) == 0: pass else: ans.append(abs(X[i] - X[i+1])) if ans == []: print(0) else: print(min(ans))