n = int(input())

r = -10000000000
y = int(input())

m = y
x = y

for i in range(1, n):
    x = int(input())
    if r < (x - m):
        r = (x - m)

    if x < m:
        m = x

print(r) n = int(input()) n int(input()) int input() input r = -10000000000 r -10000000000 y = int(input()) y int(input()) int input() input m = y m y x = y x y for i in range(1, n):
    x = int(input())
    if r < (x - m):
        r = (x - m)

    if x < m:
        m = x i range(1, n) range 1 n x = int(input()) x int(input()) int input() input if r < (x - m):
        r = (x - m)

     r < (x - m) r x - m x m r = (x - m) r x - m x m if x < m:
        m = x x < m x m m = x m x print(r) print r n = int(input()) int(input()) n y = int(input()) int(input()) y m = y y m x = y y x x = int(input()) int(input()) x r = (x - m) x - m r m = x x m r = -10000000000 -10000000000 r
n = int(input())

r = -10000000000
y = int(input())

m = y
x = y

for i in range(1, n):
    x = int(input())
    if r < (x - m):
        r = (x - m)

    if x < m:
        m = x

print(r)