n = input()
n = int(n)

x = input()
x = int(x)

present_min_value = x
max_profit_candidate = 1 - 10**9

for i in range(n - 1):
    a = input()
    a = int(a)
    diff = a - present_min_value
    if diff > max_profit_candidate:
        max_profit_candidate = diff
    if a < present_min_value:
        present_min_value = a

print(max_profit_candidate) n = input() n input() input n = int(n) n int(n) int n x = input() x input() input x = int(x) x int(x) int x present_min_value = x present_min_value x max_profit_candidate = 1 - 10**9 max_profit_candidate 1 - 10**9 1 10**9 10 9 for i in range(n - 1):
    a = input()
    a = int(a)
    diff = a - present_min_value
    if diff > max_profit_candidate:
        max_profit_candidate = diff
    if a < present_min_value:
        present_min_value = a i range(n - 1) range n - 1 n 1 a = input() a input() input a = int(a) a int(a) int a diff = a - present_min_value diff a - present_min_value a present_min_value if diff > max_profit_candidate:
        max_profit_candidate = diff
     diff > max_profit_candidate diff max_profit_candidate max_profit_candidate = diff max_profit_candidate diff if a < present_min_value:
        present_min_value = a a < present_min_value a present_min_value present_min_value = a present_min_value a print(max_profit_candidate) print max_profit_candidate a = int(a) int(a) a x = int(x) int(x) x n = input() input() n present_min_value = a a present_min_value present_min_value = x x present_min_value max_profit_candidate = 1 - 10**9 1 - 10**9 max_profit_candidate x = input() input() x a = input() input() a diff = a - present_min_value a - present_min_value diff max_profit_candidate = diff diff max_profit_candidate n = int(n) int(n) n
n = input()
n = int(n)

x = input()
x = int(x)

present_min_value = x
max_profit_candidate = 1 - 10**9

for i in range(n - 1):
    a = input()
    a = int(a)
    diff = a - present_min_value
    if diff > max_profit_candidate:
        max_profit_candidate = diff
    if a < present_min_value:
        present_min_value = a

print(max_profit_candidate)