n=int(input())
r=[int(input()) for i in range(n)]
maxv=r[1]-r[0]
minv=r[0]
for i in range(1,n):
    maxv=max(maxv,r[i]-minv)
    minv=min(minv,r[i])
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=r[1]-r[0] maxv r[1]-r[0] r[1] r 1 r[0] r 0 minv=r[0] minv r[0] r 0 for i in range(1,n):
    maxv=max(maxv,r[i]-minv)
    minv=min(minv,r[i]) i range(1,n) range 1 n maxv=max(maxv,r[i]-minv) maxv max(maxv,r[i]-minv) max maxv r[i]-minv r[i] r i minv minv=min(minv,r[i]) minv min(minv,r[i]) min minv r[i] r i print(maxv) print maxv minv=min(minv,r[i]) min(minv,r[i]) minv minv=r[0] r[0] minv maxv=r[1]-r[0] r[1]-r[0] maxv n=int(input()) int(input()) n r=[int(input()) for i in range(n)] [int(input()) for i in range(n)] r maxv=max(maxv,r[i]-minv) max(maxv,r[i]-minv) maxv
n=int(input())
r=[int(input()) for i in range(n)]
maxv=r[1]-r[0]
minv=r[0]
for i in range(1,n):
    maxv=max(maxv,r[i]-minv)
    minv=min(minv,r[i])
print(maxv)
