n = int(input()) X = list(map(int, input().split())) X = list(set(X)) if len(X) == 1: print(0) exit() X.sort() import math ans = 10*18 for i in range(len(X)-1): ans = min(ans, X[i+1]-X[i]) print(ans)