N = int(input())
R = [int(input()) for i in list(range(N))]
maxv = -1000000000
minr = R[0]

for i in list(range(1, N)):
    maxv = max(maxv, R[i] - minr)
    minr = min(minr, R[i])

print(maxv) N = int(input()) N int(input()) int input() input int(input()) for i in list(range(N)) for i in list(range(N)) i list(range(N)) list range(N) range N for i in list(range(N)) int(input()) int input() input R = [int(input()) for i in list(range(N))] R [int(input()) for i in list(range(N))] maxv = -1000000000 maxv -1000000000 minr = R[0] minr R[0] R 0 for i in list(range(1, N)):
    maxv = max(maxv, R[i] - minr)
    minr = min(minr, R[i]) i list(range(1, N)) list range(1, N) range 1 N maxv = max(maxv, R[i] - minr) maxv max(maxv, R[i] - minr) max maxv R[i] - minr R[i] R i minr minr = min(minr, R[i]) minr min(minr, R[i]) min minr R[i] R i print(maxv) print maxv minr = R[0] R[0] minr minr = min(minr, R[i]) min(minr, R[i]) minr R = [int(input()) for i in list(range(N))] [int(input()) for i in list(range(N))] R N = int(input()) int(input()) N maxv = max(maxv, R[i] - minr) max(maxv, R[i] - minr) maxv maxv = -1000000000 -1000000000 maxv
N = int(input())
R = [int(input()) for i in list(range(N))]
maxv = -1000000000
minr = R[0]

for i in list(range(1, N)):
    maxv = max(maxv, R[i] - minr)
    minr = min(minr, R[i])

print(maxv)