n = input()
minSeq = input()
maxv = -float("inf")
while True:
	try:
		R = input()
		if R - minSeq > maxv:
			maxv = R - minSeq
		if R < minSeq:
			minSeq = R
	except EOFError:
		break
print(maxv) n = input() n input() input minSeq = input() minSeq input() input maxv = -float("inf") maxv -float("inf") float("inf") float "inf" while True:
	try:
		R = input()
		if R - minSeq > maxv:
			maxv = R - minSeq
		if R < minSeq:
			minSeq = R
	except EOFError:
		break True try:
		R = input()
		if R - minSeq > maxv:
			maxv = R - minSeq
		if R < minSeq:
			minSeq = R
	except EOFError:
		break except EOFError:
		break break R = input() R input() input if R - minSeq > maxv:
			maxv = R - minSeq
		 R - minSeq > maxv R - minSeq R minSeq maxv maxv = R - minSeq maxv R - minSeq R minSeq if R < minSeq:
			minSeq = R
	 R < minSeq R minSeq minSeq = R minSeq R print(maxv) print maxv minSeq = R R minSeq maxv = -float("inf") -float("inf") maxv n = input() input() n minSeq = input() input() minSeq maxv = R - minSeq R - minSeq maxv R = input() input() R
n = input()
minSeq = input()
maxv = -float("inf")
while True:
	try:
		R = input()
		if R - minSeq > maxv:
			maxv = R - minSeq
		if R < minSeq:
			minSeq = R
	except EOFError:
		break
print(maxv)