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