N = input() n = input() m = n.split() p = [int(i) for i in m] a1 = p[1] - p[0] for i, value in enumerate(p): if i == 0 or i == 1: pass else: b = value - p[i - 1] if b == 0: print("0") break elif b < a1: a1 = b else: pass else: print(a1) print(p[-1] - p[0])