n = int(input()) 
price = [int(input()) for i in range(n)]
maxp = price[1] - price[0]
minp = price[0]
for j in range(1, n):
    maxp = max([maxp, price[j] - minp])
    minp = min([minp, price[j]])
print(maxp) n = int(input()) n int(input()) int input() input int(input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(input()) int input() input price = [int(input()) for i in range(n)] price [int(input()) for i in range(n)] maxp = price[1] - price[0] maxp price[1] - price[0] price[1] price 1 price[0] price 0 minp = price[0] minp price[0] price 0 for j in range(1, n):
    maxp = max([maxp, price[j] - minp])
    minp = min([minp, price[j]]) j range(1, n) range 1 n maxp = max([maxp, price[j] - minp]) maxp max([maxp, price[j] - minp]) max [maxp, price[j] - minp] maxp price[j] - minp price[j] price j minp minp = min([minp, price[j]]) minp min([minp, price[j]]) min [minp, price[j]] minp price[j] price j print(maxp) print maxp maxp = price[1] - price[0] price[1] - price[0] maxp n = int(input()) int(input()) n maxp = max([maxp, price[j] - minp]) max([maxp, price[j] - minp]) maxp minp = min([minp, price[j]]) min([minp, price[j]]) minp price = [int(input()) for i in range(n)] [int(input()) for i in range(n)] price minp = price[0] price[0] minp
n = int(input()) 
price = [int(input()) for i in range(n)]
maxp = price[1] - price[0]
minp = price[0]
for j in range(1, n):
    maxp = max([maxp, price[j] - minp])
    minp = min([minp, price[j]])
print(maxp)
