n = int(input())
stack = []
for _ in range(n):
    stack.append(int(input()))

maxv = -10**9
minv = stack[0]
for i in range(1, len(stack)):
    maxv = max(maxv, stack[i] - minv)
    minv = min(minv, stack[i])

print(maxv) n = int(input()) n int(input()) int input() input stack = [] stack [] for _ in range(n):
    stack.append(int(input())) _ range(n) range n stack.append(int(input())) stack.append stack append int(input()) int input() input maxv = -10**9 maxv -10**9 -10 9 minv = stack[0] minv stack[0] stack 0 for i in range(1, len(stack)):
    maxv = max(maxv, stack[i] - minv)
    minv = min(minv, stack[i]) i range(1, len(stack)) range 1 len(stack) len stack maxv = max(maxv, stack[i] - minv) maxv max(maxv, stack[i] - minv) max maxv stack[i] - minv stack[i] stack i minv minv = min(minv, stack[i]) minv min(minv, stack[i]) min minv stack[i] stack i print(maxv) print maxv n = int(input()) int(input()) n minv = min(minv, stack[i]) min(minv, stack[i]) minv stack = [] [] stack minv = stack[0] stack[0] minv maxv = max(maxv, stack[i] - minv) max(maxv, stack[i] - minv) maxv maxv = -10**9 -10**9 maxv
n = int(input())
stack = []
for _ in range(n):
    stack.append(int(input()))

maxv = -10**9
minv = stack[0]
for i in range(1, len(stack)):
    maxv = max(maxv, stack[i] - minv)
    minv = min(minv, stack[i])

print(maxv)