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

max_j = n - 1
max_diff = r[max_j] - r[max_j - 1]

for i in range(n-3, -1, -1):
    if r[i+1] > r[max_j]:
        max_j = i + 1
    tmp_diff = r[max_j] - r[i]
    if max_diff < tmp_diff:
        max_diff = tmp_diff

print(max_diff) n = int(input()) n int(input()) int input() input r = [] r [] for i in range(n):
    r.append(int(input())) i range(n) range n r.append(int(input())) r.append r append int(input()) int input() input max_j = n - 1 max_j n - 1 n 1 max_diff = r[max_j] - r[max_j - 1] max_diff r[max_j] - r[max_j - 1] r[max_j] r max_j r[max_j - 1] r max_j - 1 max_j 1 for i in range(n-3, -1, -1):
    if r[i+1] > r[max_j]:
        max_j = i + 1
    tmp_diff = r[max_j] - r[i]
    if max_diff < tmp_diff:
        max_diff = tmp_diff i range(n-3, -1, -1) range n-3 n 3 -1 -1 if r[i+1] > r[max_j]:
        max_j = i + 1
     r[i+1] > r[max_j] r[i+1] r i+1 i 1 r[max_j] r max_j max_j = i + 1 max_j i + 1 i 1 tmp_diff = r[max_j] - r[i] tmp_diff r[max_j] - r[i] r[max_j] r max_j r[i] r i if max_diff < tmp_diff:
        max_diff = tmp_diff max_diff < tmp_diff max_diff tmp_diff max_diff = tmp_diff max_diff tmp_diff print(max_diff) print max_diff max_diff = tmp_diff tmp_diff max_diff n = int(input()) int(input()) n max_j = n - 1 n - 1 max_j r = [] [] r max_diff = r[max_j] - r[max_j - 1] r[max_j] - r[max_j - 1] max_diff tmp_diff = r[max_j] - r[i] r[max_j] - r[i] tmp_diff max_j = i + 1 i + 1 max_j
n = int(input())
r = []
for i in range(n):
    r.append(int(input()))

max_j = n - 1
max_diff = r[max_j] - r[max_j - 1]

for i in range(n-3, -1, -1):
    if r[i+1] > r[max_j]:
        max_j = i + 1
    tmp_diff = r[max_j] - r[i]
    if max_diff < tmp_diff:
        max_diff = tmp_diff

print(max_diff)
