N = int(input())
R = [int(input()) for i in range(N)]

maxv = -20000000000
minv = R[0]

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

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

maxv = -20000000000
minv = R[0]

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

print(maxv)