N = int(input()) X = list(map(int,input().split())) X.sort() ans = 1<<32 for i in range(N-1): ans = min(ans, X[i+1]-X[i]) if N == 1: ans = 0 print(ans)