num = int(input())
min = int(input())
diff = -2000000000

for var in range(1,num):
    data = int(input())
    current = data - min
    if current > diff :
        diff = current
    if min > data :
        min = data

print(diff) num = int(input()) num int(input()) int input() input min = int(input()) min int(input()) int input() input diff = -2000000000 diff -2000000000 for var in range(1,num):
    data = int(input())
    current = data - min
    if current > diff :
        diff = current
    if min > data :
        min = data var range(1,num) range 1 num data = int(input()) data int(input()) int input() input current = data - min current data - min data min if current > diff :
        diff = current
     current > diff current diff diff = current diff current if min > data :
        min = data min > data min data min = data min data print(diff) print diff min = int(input()) int(input()) min diff = -2000000000 -2000000000 diff current = data - min data - min current min = data data min num = int(input()) int(input()) num diff = current current diff data = int(input()) int(input()) data
num = int(input())
min = int(input())
diff = -2000000000

for var in range(1,num):
    data = int(input())
    current = data - min
    if current > diff :
        diff = current
    if min > data :
        min = data

print(diff)