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