N = int(input()) X = sorted(set(map(int, input().split()))) L = [X[i+1] - X[i] for i in range(len(X)-1)] print(min(L) if len(L) > 0 else 0)