n = input()

R = []
for i in range(n):
    R.append(input())

min_v = R[0]
max_v = -1000000000000
for i in range(1, n):
    temp = R[i] - min_v
    if (temp >= max_v):
        max_v = temp
    temp = R[i]
    if (min_v >= temp):
        min_v = temp
print max_v n = input() n input() input R = [] R [] for i in range(n):
    R.append(input()) i range(n) range n R.append(input()) R.append R append input() input min_v = R[0] min_v R[0] R 0 max_v = -1000000000000 max_v -1000000000000 for i in range(1, n):
    temp = R[i] - min_v
    if (temp >= max_v):
        max_v = temp
    temp = R[i]
    if (min_v >= temp):
        min_v = temp i range(1, n) range 1 n temp = R[i] - min_v temp R[i] - min_v R[i] R i min_v if (temp >= max_v):
        max_v = temp
     temp >= max_v temp max_v max_v = temp max_v temp temp = R[i] temp R[i] R i if (min_v >= temp):
        min_v = temp min_v >= temp min_v temp min_v = temp min_v temp print min_v = temp temp min_v temp = R[i] - min_v R[i] - min_v temp R = [] [] R max_v = temp temp max_v temp = R[i] R[i] temp n = input() input() n max_v = -1000000000000 -1000000000000 max_v min_v = R[0] R[0] min_v
n = input()

R = []
for i in range(n):
    R.append(input())

min_v = R[0]
max_v = -1000000000000
for i in range(1, n):
    temp = R[i] - min_v
    if (temp >= max_v):
        max_v = temp
    temp = R[i]
    if (min_v >= temp):
        min_v = temp
print max_v