N = int(input())
price_list = [int(input()) for _ in range(N)]

purchase_price = price_list[0]
profit = price_list[1] - purchase_price
for price in price_list[1:]:
    profit = max(profit, (price-purchase_price))
    purchase_price = min(price, purchase_price)

print(profit) N = int(input()) N int(input()) int input() input int(input()) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) int(input()) int input() input price_list = [int(input()) for _ in range(N)] price_list [int(input()) for _ in range(N)] purchase_price = price_list[0] purchase_price price_list[0] price_list 0 profit = price_list[1] - purchase_price profit price_list[1] - purchase_price price_list[1] price_list 1 purchase_price for price in price_list[1:]:
    profit = max(profit, (price-purchase_price))
    purchase_price = min(price, purchase_price) price price_list[1:] price_list 1: 1 profit = max(profit, (price-purchase_price)) profit max(profit, (price-purchase_price)) max profit price-purchase_price price purchase_price purchase_price = min(price, purchase_price) purchase_price min(price, purchase_price) min price purchase_price print(profit) print profit purchase_price = min(price, purchase_price) min(price, purchase_price) purchase_price profit = max(profit, (price-purchase_price)) max(profit, (price-purchase_price)) profit N = int(input()) int(input()) N price_list = [int(input()) for _ in range(N)] [int(input()) for _ in range(N)] price_list purchase_price = price_list[0] price_list[0] purchase_price profit = price_list[1] - purchase_price price_list[1] - purchase_price profit
N = int(input())
price_list = [int(input()) for _ in range(N)]

purchase_price = price_list[0]
profit = price_list[1] - purchase_price
for price in price_list[1:]:
    profit = max(profit, (price-purchase_price))
    purchase_price = min(price, purchase_price)

print(profit)
