n = int(raw_input())
r = []
for i in range(n):
    r.append(int(raw_input()))

min_v = r[0]
max_profit = -1000000000000
for i in range(1,n):
    if max_profit < r[i] - min_v:
        max_profit = r[i]-min_v
    if r[i] < min_v:
        min_v = r[i]

print max_profit n = int(raw_input()) n int(raw_input()) int raw_input() raw_input r = [] r [] for i in range(n):
    r.append(int(raw_input())) i range(n) range n r.append(int(raw_input())) r.append r append int(raw_input()) int raw_input() raw_input min_v = r[0] min_v r[0] r 0 max_profit = -1000000000000 max_profit -1000000000000 for i in range(1,n):
    if max_profit < r[i] - min_v:
        max_profit = r[i]-min_v
    if r[i] < min_v:
        min_v = r[i] i range(1,n) range 1 n if max_profit < r[i] - min_v:
        max_profit = r[i]-min_v
     max_profit < r[i] - min_v max_profit r[i] - min_v r[i] r i min_v max_profit = r[i]-min_v max_profit r[i]-min_v r[i] r i min_v if r[i] < min_v:
        min_v = r[i] r[i] < min_v r[i] r i min_v min_v = r[i] min_v r[i] r i print r = [] [] r min_v = r[i] r[i] min_v max_profit = -1000000000000 -1000000000000 max_profit min_v = r[0] r[0] min_v max_profit = r[i]-min_v r[i]-min_v max_profit n = int(raw_input()) int(raw_input()) n
n = int(raw_input())
r = []
for i in range(n):
    r.append(int(raw_input()))

min_v = r[0]
max_profit = -1000000000000
for i in range(1,n):
    if max_profit < r[i] - min_v:
        max_profit = r[i]-min_v
    if r[i] < min_v:
        min_v = r[i]

print max_profit