f = lambda: int(input())
d = -float('inf')
n = f()
l = f()
for _ in range(n-1):
	r = f()
	d = max(d, r-l)
	l = min(l, r)
print(d) f = lambda: int(input()) f lambda: int(input()) int(input()) int input() input d = -float('inf') d -float('inf') float('inf') float 'inf' n = f() n f() f l = f() l f() f for _ in range(n-1):
	r = f()
	d = max(d, r-l)
	l = min(l, r) _ range(n-1) range n-1 n 1 r = f() r f() f d = max(d, r-l) d max(d, r-l) max d r-l r l l = min(l, r) l min(l, r) min l r print(d) print d d = -float('inf') -float('inf') d r = f() f() r l = f() f() l d = max(d, r-l) max(d, r-l) d l = min(l, r) min(l, r) l f = lambda: int(input()) lambda: int(input()) f n = f() f() n
f = lambda: int(input())
d = -float('inf')
n = f()
l = f()
for _ in range(n-1):
	r = f()
	d = max(d, r-l)
	l = min(l, r)
print(d)
