import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N,*X = map(int,read().split()) X = sorted(set(X)) if len(X) == 1: print(0) else: x = min(y - x for x,y in zip(X,X[1:])) print(x)