count = int(input())
nums = [int(x) for x in input().split()]
prev = nums[0]
rlt = list()
temp = list()
temp.append(prev)
is_up = True
if count == 1:
print(0)
else:
for i in range(1, count):
if prev < nums[i]:
pass
else:
rlt.append(temp)
temp = list()
# print(prev, rlt)
prev = nums[i]
temp.append(prev)
rlt.append(temp)
max_height = 0
for i in rlt:
temp = (max(i)-min(i))
if max_height < temp:
max_height = temp
print(max_height)
N = int(input())
arr = list(map(int, input().split()))
pre = arr[0]
max_h = 0
tmp = [arr[0]]
for h in arr[1:]:
if h > pre:
tmp.append(h)
pre = h
elif h <=pre:
h_d = tmp[-1] - tmp[0]
if h_d > max_h:
max_h = h_d
tmp = [h]
pre = h
if len(tmp) >= 2:
h_d = tmp[-1] - tmp[0]
if h_d > max_h:
max_h = h_d
print(max_h)