n = int(input())
R = [int(input()) for i in range(n)]
profit= R[1] - R[0]
mn = R[0]
R.pop(0)
for i in R:
    if profit < i - mn:
        profit = i - mn
        if 0 > i - mn:
            mn = i
    elif mn > i:
        mn = i

print(profit) 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 R = [int(input()) for i in range(n)] R [int(input()) for i in range(n)] profit= R[1] - R[0] profit R[1] - R[0] R[1] R 1 R[0] R 0 mn = R[0] mn R[0] R 0 R.pop(0) R.pop R pop 0 for i in R:
    if profit < i - mn:
        profit = i - mn
        if 0 > i - mn:
            mn = i
    elif mn > i:
        mn = i i R if profit < i - mn:
        profit = i - mn
        if 0 > i - mn:
            mn = i
    elif mn > i:
        mn = i profit < i - mn profit i - mn i mn profit = i - mn profit i - mn i mn if 0 > i - mn:
            mn = i
     0 > i - mn 0 i - mn i mn mn = i mn i elif mn > i:
        mn = i mn > i mn i mn = i mn i print(profit) print profit R = [int(input()) for i in range(n)] [int(input()) for i in range(n)] R profit= R[1] - R[0] R[1] - R[0] profit mn = i i mn mn = i i mn mn = R[0] R[0] mn n = int(input()) int(input()) n profit = i - mn i - mn profit
n = int(input())
R = [int(input()) for i in range(n)]
profit= R[1] - R[0]
mn = R[0]
R.pop(0)
for i in R:
    if profit < i - mn:
        profit = i - mn
        if 0 > i - mn:
            mn = i
    elif mn > i:
        mn = i

print(profit)