_temp = []

size = int(input().rstrip())
for i in range(size):
    try:
        _temp.append(int(input()))
    except EOFError:
        continue

my_max = -20000000000000
my_min = _temp.pop(0)


for val in _temp:
    my_max = max(my_max, (val - my_min))
    my_min = min(my_min, val)

print(my_max) _temp = [] _temp [] size = int(input().rstrip()) size int(input().rstrip()) int input().rstrip() ().rstrip () input rstrip for i in range(size):
    try:
        _temp.append(int(input()))
    except EOFError:
        continue i range(size) range size try:
        _temp.append(int(input()))
    except EOFError:
        continue except EOFError:
        continue continue _temp.append(int(input())) _temp.append _temp append int(input()) int input() input my_max = -20000000000000 my_max -20000000000000 my_min = _temp.pop(0) my_min _temp.pop(0) _temp.pop _temp pop 0 for val in _temp:
    my_max = max(my_max, (val - my_min))
    my_min = min(my_min, val) val _temp my_max = max(my_max, (val - my_min)) my_max max(my_max, (val - my_min)) max my_max val - my_min val my_min my_min = min(my_min, val) my_min min(my_min, val) min my_min val print(my_max) print my_max _temp = [] [] _temp my_max = max(my_max, (val - my_min)) max(my_max, (val - my_min)) my_max size = int(input().rstrip()) int(input().rstrip()) size my_max = -20000000000000 -20000000000000 my_max my_min = min(my_min, val) min(my_min, val) my_min my_min = _temp.pop(0) _temp.pop(0) my_min
_temp = []

size = int(input().rstrip())
for i in range(size):
    try:
        _temp.append(int(input()))
    except EOFError:
        continue

my_max = -20000000000000
my_min = _temp.pop(0)


for val in _temp:
    my_max = max(my_max, (val - my_min))
    my_min = min(my_min, val)

print(my_max)