N=int(input())
R=[int(input()) for x in range(N)]
maxv=-10**9
minv=R[0]
for r in R[1:]:
    maxv = max(r-minv,maxv)
    minv = min(r,minv)
print(maxv) N=int(input()) N int(input()) int input() input int(input()) for x in range(N) for x in range(N) x range(N) range N for x in range(N) int(input()) int input() input R=[int(input()) for x in range(N)] R [int(input()) for x in range(N)] maxv=-10**9 maxv -10**9 -10 9 minv=R[0] minv R[0] R 0 for r in R[1:]:
    maxv = max(r-minv,maxv)
    minv = min(r,minv) r R[1:] R 1: 1 maxv = max(r-minv,maxv) maxv max(r-minv,maxv) max r-minv r minv maxv minv = min(r,minv) minv min(r,minv) min r minv print(maxv) print maxv N=int(input()) int(input()) N R=[int(input()) for x in range(N)] [int(input()) for x in range(N)] R maxv=-10**9 -10**9 maxv maxv = max(r-minv,maxv) max(r-minv,maxv) maxv minv = min(r,minv) min(r,minv) minv minv=R[0] R[0] minv
N=int(input())
R=[int(input()) for x in range(N)]
maxv=-10**9
minv=R[0]
for r in R[1:]:
    maxv = max(r-minv,maxv)
    minv = min(r,minv)
print(maxv)