n = int(input()) numList = list(map(int, input().split())) numList = sorted(numList) min for i in range(n): if (i == n - 1): break elif i == 0: # 初回の場合 無条件で最小値を代入 min = abs(numList[i] - numList[i + 1]) continue; elif min > abs(numList[i] - numList[i + 1]): min = abs(numList[i] - numList[i + 1]) print(min)