n = int(input())
lo = 10 ** 10
diff = -10 ** 9
for _ in range(n):
    r = int(input())
    diff = max(diff, r - lo)
    lo = min(lo, r)
print(diff) n = int(input()) n int(input()) int input() input lo = 10 ** 10 lo 10 ** 10 10 10 diff = -10 ** 9 diff -10 ** 9 -10 9 for _ in range(n):
    r = int(input())
    diff = max(diff, r - lo)
    lo = min(lo, r) _ range(n) range n r = int(input()) r int(input()) int input() input diff = max(diff, r - lo) diff max(diff, r - lo) max diff r - lo r lo lo = min(lo, r) lo min(lo, r) min lo r print(diff) print diff lo = 10 ** 10 10 ** 10 lo lo = min(lo, r) min(lo, r) lo diff = max(diff, r - lo) max(diff, r - lo) diff r = int(input()) int(input()) r diff = -10 ** 9 -10 ** 9 diff n = int(input()) int(input()) n
n = int(input())
lo = 10 ** 10
diff = -10 ** 9
for _ in range(n):
    r = int(input())
    diff = max(diff, r - lo)
    lo = min(lo, r)
print(diff)
