n = input()

a = input()
temp = a
b = input()
temp = b if b < temp else temp
for _ in xrange(n-2):
    now = input()
    if (b - a) < (now - temp):
        a, b = temp, now
    if now < temp:
        temp = now
    elif now > b:
        b = now
print b - a n = input() n input() input a = input() a input() input temp = a temp a b = input() b input() input temp = b if b < temp else temp temp b if b < temp else temp b < temp b temp b temp for _ in xrange(n-2):
    now = input()
    if (b - a) < (now - temp):
        a, b = temp, now
    if now < temp:
        temp = now
    elif now > b:
        b = now _ xrange(n-2) xrange n-2 n 2 now = input() now input() input if (b - a) < (now - temp):
        a, b = temp, now
     (b - a) < (now - temp) b - a b a now - temp now temp a, b = temp, now a temp b now if now < temp:
        temp = now
    elif now > b:
        b = now now < temp now temp temp = now temp now elif now > b:
        b = now now > b now b b = now b now print b - a b a a, b = temp, now temp a a = input() input() a b = temp, now now b n = input() input() n now = input() input() now temp = a a temp temp = b if b < temp else temp b if b < temp else temp temp b = input() input() b temp = now now temp b = now now b
n = input()

a = input()
temp = a
b = input()
temp = b if b < temp else temp
for _ in xrange(n-2):
    now = input()
    if (b - a) < (now - temp):
        a, b = temp, now
    if now < temp:
        temp = now
    elif now > b:
        b = now
print b - a