n = int(raw_input())

_min, dif = 10**10, -10**10
for x in xrange(n):
    a = int(raw_input())
    if a -_min > dif:
        dif = a - _min
    if a < _min:
        _min = a
print dif n = int(raw_input()) n int(raw_input()) int raw_input() raw_input _min, dif = 10**10, -10**10 _min 10**10 10 10 dif -10**10 -10 10 for x in xrange(n):
    a = int(raw_input())
    if a -_min > dif:
        dif = a - _min
    if a < _min:
        _min = a x xrange(n) xrange n a = int(raw_input()) a int(raw_input()) int raw_input() raw_input if a -_min > dif:
        dif = a - _min
     a -_min > dif a -_min a _min dif dif = a - _min dif a - _min a _min if a < _min:
        _min = a a < _min a _min _min = a _min a print dif = a - _min a - _min dif a = int(raw_input()) int(raw_input()) a _min = a a _min dif = 10**10, -10**10 -10**10 dif _min, dif = 10**10, -10**10 10**10 _min n = int(raw_input()) int(raw_input()) n
n = int(raw_input())

_min, dif = 10**10, -10**10
for x in xrange(n):
    a = int(raw_input())
    if a -_min > dif:
        dif = a - _min
    if a < _min:
        _min = a
print dif