n = int(input()) numList = list(map(int, input().split())) ret = None for i in range(n): if (i == n - 1): break val = abs(numList[i] - numList[i + 1]) if i == 0: ret = val continue elif (val == 0): continue elif (ret > val): ret = val if ret == None: ret = 0 print(ret)