N = int(input())

RMax = 0
R = []


for i in range(N):
	r = int(input())
	if i == 0:
		rmi = r
	if i == 1:
		RMax = r - R[0]
	if i > 0:		
		rdif = (r - rmi)
		if rdif >= RMax:
			RMax = rdif
	R.append(r)
	if r < rmi:
		rmi = r

print(RMax) N = int(input()) N int(input()) int input() input RMax = 0 RMax 0 R = [] R [] for i in range(N):
	r = int(input())
	if i == 0:
		rmi = r
	if i == 1:
		RMax = r - R[0]
	if i > 0:		
		rdif = (r - rmi)
		if rdif >= RMax:
			RMax = rdif
	R.append(r)
	if r < rmi:
		rmi = r i range(N) range N r = int(input()) r int(input()) int input() input if i == 0:
		rmi = r
	 i == 0 i 0 rmi = r rmi r if i == 1:
		RMax = r - R[0]
	 i == 1 i 1 RMax = r - R[0] RMax r - R[0] r R[0] R 0 if i > 0:		
		rdif = (r - rmi)
		if rdif >= RMax:
			RMax = rdif
	 i > 0 i 0 rdif = (r - rmi) rdif r - rmi r rmi if rdif >= RMax:
			RMax = rdif
	 rdif >= RMax rdif RMax RMax = rdif RMax rdif R.append(r) R.append R append r if r < rmi:
		rmi = r r < rmi r rmi rmi = r rmi r print(RMax) print RMax r = int(input()) int(input()) r RMax = 0 0 RMax rmi = r r rmi rmi = r r rmi RMax = r - R[0] r - R[0] RMax rdif = (r - rmi) r - rmi rdif R = [] [] R N = int(input()) int(input()) N RMax = rdif rdif RMax
N = int(input())

RMax = 0
R = []


for i in range(N):
	r = int(input())
	if i == 0:
		rmi = r
	if i == 1:
		RMax = r - R[0]
	if i > 0:		
		rdif = (r - rmi)
		if rdif >= RMax:
			RMax = rdif
	R.append(r)
	if r < rmi:
		rmi = r

print(RMax)