n=input()
min = None
max = None
cand=None

for x in xrange(n):
    v = input()
   
    # print "#### %s %s %s %s" % (str(max), str(min), str(cand), str(v))

    if min is None:
        min = v
        # print "min is None"
        continue

    if min > v:
        # print "min > v"
        if (cand is None) or (cand < v-min):
            # print "cand None"
            cand = v-min
        min = v
        max = None
        continue

    elif (max is None) or (max < v):
        # print "max is None"
        max = v
        if cand < max - min:
            cand = max - min
        continue

print cand n=input() n input() input min = None min None max = None max None cand=None cand None for x in xrange(n):
    v = input()
   
    # print "#### %s %s %s %s" % (str(max), str(min), str(cand), str(v))

    if min is None:
        min = v
        # print "min is None"
        continue

    if min > v:
        # print "min > v"
        if (cand is None) or (cand < v-min):
            # print "cand None"
            cand = v-min
        min = v
        max = None
        continue

    elif (max is None) or (max < v):
        # print "max is None"
        max = v
        if cand < max - min:
            cand = max - min
        continue x xrange(n) xrange n v = input() v input() input if min is None:
        min = v
        # print "min is None"
        continue

     min is None min None min = v min v continue if min > v:
        # print "min > v"
        if (cand is None) or (cand < v-min):
            # print "cand None"
            cand = v-min
        min = v
        max = None
        continue

    elif (max is None) or (max < v):
        # print "max is None"
        max = v
        if cand < max - min:
            cand = max - min
        continue min > v min v if (cand is None) or (cand < v-min):
            # print "cand None"
            cand = v-min
         (cand is None) or (cand < v-min) cand is None cand None cand < v-min cand v-min v min cand = v-min cand v-min v min min = v min v max = None max None continue elif (max is None) or (max < v):
        # print "max is None"
        max = v
        if cand < max - min:
            cand = max - min
        continue (max is None) or (max < v) max is None max None max < v max v max = v max v if cand < max - min:
            cand = max - min
         cand < max - min cand max - min max min cand = max - min cand max - min max min continue print max = None None max n=input() input() n max = v v max cand = v-min v-min cand cand = max - min max - min cand v = input() input() v min = v v min cand=None None cand min = None None min max = None None max min = v v min
n=input()
min = None
max = None
cand=None

for x in xrange(n):
    v = input()
   
    # print "#### %s %s %s %s" % (str(max), str(min), str(cand), str(v))

    if min is None:
        min = v
        # print "min is None"
        continue

    if min > v:
        # print "min > v"
        if (cand is None) or (cand < v-min):
            # print "cand None"
            cand = v-min
        min = v
        max = None
        continue

    elif (max is None) or (max < v):
        # print "max is None"
        max = v
        if cand < max - min:
            cand = max - min
        continue

print cand