input_n = input()
price1  = input()
price2  = input()
min_price = min(price1,price2)
max_profit = price2-price1
for i in xrange(input_n-2):
    input_profit = input()
    tmp = input_profit-min_price
    if max_profit<tmp:
        max_profit = tmp
    if min_price>input_profit:
        min_price = input_profit
print max_profit input_n = input() input_n input() input price1  = input() price1 input() input price2  = input() price2 input() input min_price = min(price1,price2) min_price min(price1,price2) min price1 price2 max_profit = price2-price1 max_profit price2-price1 price2 price1 for i in xrange(input_n-2):
    input_profit = input()
    tmp = input_profit-min_price
    if max_profit<tmp:
        max_profit = tmp
    if min_price>input_profit:
        min_price = input_profit i xrange(input_n-2) xrange input_n-2 input_n 2 input_profit = input() input_profit input() input tmp = input_profit-min_price tmp input_profit-min_price input_profit min_price if max_profit<tmp:
        max_profit = tmp
     max_profit<tmp max_profit tmp max_profit = tmp max_profit tmp if min_price>input_profit:
        min_price = input_profit min_price>input_profit min_price input_profit min_price = input_profit min_price input_profit print min_price = min(price1,price2) min(price1,price2) min_price max_profit = price2-price1 price2-price1 max_profit input_profit = input() input() input_profit tmp = input_profit-min_price input_profit-min_price tmp price1  = input() input() price1 price2  = input() input() price2 min_price = input_profit input_profit min_price input_n = input() input() input_n max_profit = tmp tmp max_profit
input_n = input()
price1  = input()
price2  = input()
min_price = min(price1,price2)
max_profit = price2-price1
for i in xrange(input_n-2):
    input_profit = input()
    tmp = input_profit-min_price
    if max_profit<tmp:
        max_profit = tmp
    if min_price>input_profit:
        min_price = input_profit
print max_profit