# No.135 とりあえず1次元の問題 import sys n = int(input()) x = [int(i) for i in input().split()] if x == [] or len(x) <= 1: print(0) minimum = sys.maxsize for i in range(n): for j in range(i + 1, n): minimum = min(minimum, abs(x[i] - x[j])) print(minimum)