n=int(input())
num=[int(input()) for i in range(n)]

maxv=num[1]-num[0]
minv=num[0]

for j,n in enumerate(num[1:]):
    maxv=max(maxv,n-minv)
    minv=min(minv,num[j+1])

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

maxv=num[1]-num[0]
minv=num[0]

for j,n in enumerate(num[1:]):
    maxv=max(maxv,n-minv)
    minv=min(minv,num[j+1])

print(maxv)