N = input() X = list(map(int, input().split())) X.sort() min_num = 100001 for i, Xi in enumerate(X): n = 0 if i > 0: n = Xi - X[i-1] if n!=0 and min_num > n: min_num = n print(min_num)