N = int(input()) X = sorted(list(set(map(int,input().split())))) ans = 1000000 if len(X) <= 1: print(0) else: for i in range(len(X)-1): res = X[i + 1] - X[i] if ans > res: ans = res print(ans)