N = int(input()) X = sorted(list(map(int,input().split()))) ans = 10**6 for i in range(N-1): ans = min(ans,X[i+1]-X[i]) print(ans)