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