times = int(input())
element = []

for i in range(times):
    element.append(int(input()))

maxv = element[1]-element[0]
minv = element[0]
for j in range(1,len(element)):
    maxv = max(element[j]-minv,maxv)
    minv = min(minv,element[j])

print(maxv) times = int(input()) times int(input()) int input() input element = [] element [] for i in range(times):
    element.append(int(input())) i range(times) range times element.append(int(input())) element.append element append int(input()) int input() input maxv = element[1]-element[0] maxv element[1]-element[0] element[1] element 1 element[0] element 0 minv = element[0] minv element[0] element 0 for j in range(1,len(element)):
    maxv = max(element[j]-minv,maxv)
    minv = min(minv,element[j]) j range(1,len(element)) range 1 len(element) len element maxv = max(element[j]-minv,maxv) maxv max(element[j]-minv,maxv) max element[j]-minv element[j] element j minv maxv minv = min(minv,element[j]) minv min(minv,element[j]) min minv element[j] element j print(maxv) print maxv times = int(input()) int(input()) times maxv = element[1]-element[0] element[1]-element[0] maxv minv = min(minv,element[j]) min(minv,element[j]) minv element = [] [] element maxv = max(element[j]-minv,maxv) max(element[j]-minv,maxv) maxv minv = element[0] element[0] minv
times = int(input())
element = []

for i in range(times):
    element.append(int(input()))

maxv = element[1]-element[0]
minv = element[0]
for j in range(1,len(element)):
    maxv = max(element[j]-minv,maxv)
    minv = min(minv,element[j])

print(maxv)