priceList = []
t = raw_input()


for i in range(int(t)):
    priceList.append(int(input()))

maxv = -2000000000
minv = priceList[0]

for i in range(1, int(t)):
	if maxv < priceList[i] - minv:
		maxv = priceList[i] - minv
	if minv > priceList[i]:
		minv = priceList[i]
    
print maxv priceList = [] priceList [] t = raw_input() t raw_input() raw_input for i in range(int(t)):
    priceList.append(int(input())) i range(int(t)) range int(t) int t priceList.append(int(input())) priceList.append priceList append int(input()) int input() input maxv = -2000000000 maxv -2000000000 minv = priceList[0] minv priceList[0] priceList 0 for i in range(1, int(t)):
	if maxv < priceList[i] - minv:
		maxv = priceList[i] - minv
	if minv > priceList[i]:
		minv = priceList[i]
     i range(1, int(t)) range 1 int(t) int t if maxv < priceList[i] - minv:
		maxv = priceList[i] - minv
	 maxv < priceList[i] - minv maxv priceList[i] - minv priceList[i] priceList i minv maxv = priceList[i] - minv maxv priceList[i] - minv priceList[i] priceList i minv if minv > priceList[i]:
		minv = priceList[i]
     minv > priceList[i] minv priceList[i] priceList i minv = priceList[i] minv priceList[i] priceList i print minv = priceList[i] priceList[i] minv t = raw_input() raw_input() t maxv = priceList[i] - minv priceList[i] - minv maxv minv = priceList[0] priceList[0] minv maxv = -2000000000 -2000000000 maxv priceList = [] [] priceList
priceList = []
t = raw_input()


for i in range(int(t)):
    priceList.append(int(input()))

maxv = -2000000000
minv = priceList[0]

for i in range(1, int(t)):
	if maxv < priceList[i] - minv:
		maxv = priceList[i] - minv
	if minv > priceList[i]:
		minv = priceList[i]
    
print maxv