
num = int(input())
max_value = float("-inf")
min_value = float("inf")

for i in [int(input()) for x in range(num)]:

    if max_value < (i - min_value):
        max_value = i - min_value

    if min_value > i:
        min_value = i

print(max_value) num = int(input()) num int(input()) int input() input max_value = float("-inf") max_value float("-inf") float "-inf" min_value = float("inf") min_value float("inf") float "inf" for i in [int(input()) for x in range(num)]:

    if max_value < (i - min_value):
        max_value = i - min_value

    if min_value > i:
        min_value = i i [int(input()) for x in range(num)] if max_value < (i - min_value):
        max_value = i - min_value

     max_value < (i - min_value) max_value i - min_value i min_value max_value = i - min_value max_value i - min_value i min_value if min_value > i:
        min_value = i min_value > i min_value i min_value = i min_value i print(max_value) print max_value num = int(input()) int(input()) num max_value = i - min_value i - min_value max_value min_value = float("inf") float("inf") min_value min_value = i i min_value max_value = float("-inf") float("-inf") max_value

num = int(input())
max_value = float("-inf")
min_value = float("inf")

for i in [int(input()) for x in range(num)]:

    if max_value < (i - min_value):
        max_value = i - min_value

    if min_value > i:
        min_value = i

print(max_value)