n=input()
min = input()
profit = None

for x in xrange(n-1):
    v = input()
    if profit is None:
        profit = v - min
    if profit < v - min:
        profit = v-min
    if min > v:
        min = v
print profit n=input() n input() input min = input() min input() input profit = None profit None for x in xrange(n-1):
    v = input()
    if profit is None:
        profit = v - min
    if profit < v - min:
        profit = v-min
    if min > v:
        min = v x xrange(n-1) xrange n-1 n 1 v = input() v input() input if profit is None:
        profit = v - min
     profit is None profit None profit = v - min profit v - min v min if profit < v - min:
        profit = v-min
     profit < v - min profit v - min v min profit = v-min profit v-min v min if min > v:
        min = v min > v min v min = v min v print profit = v-min v-min profit v = input() input() v min = input() input() min profit = v - min v - min profit n=input() input() n profit = None None profit min = v v min
n=input()
min = input()
profit = None

for x in xrange(n-1):
    v = input()
    if profit is None:
        profit = v - min
    if profit < v - min:
        profit = v-min
    if min > v:
        min = v
print profit