dif = -1E9
n = int(input())
mn = int(input())
for i in range(n - 1):
    r = int(input())
    if r - mn > dif:
        dif = r - mn
    if r < mn:
        mn = r
print(dif) dif = -1E9 dif -1E9 n = int(input()) n int(input()) int input() input mn = int(input()) mn int(input()) int input() input for i in range(n - 1):
    r = int(input())
    if r - mn > dif:
        dif = r - mn
    if r < mn:
        mn = r i range(n - 1) range n - 1 n 1 r = int(input()) r int(input()) int input() input if r - mn > dif:
        dif = r - mn
     r - mn > dif r - mn r mn dif dif = r - mn dif r - mn r mn if r < mn:
        mn = r r < mn r mn mn = r mn r print(dif) print dif dif = -1E9 -1E9 dif n = int(input()) int(input()) n mn = int(input()) int(input()) mn dif = r - mn r - mn dif mn = r r mn r = int(input()) int(input()) r
dif = -1E9
n = int(input())
mn = int(input())
for i in range(n - 1):
    r = int(input())
    if r - mn > dif:
        dif = r - mn
    if r < mn:
        mn = r
print(dif)