#coding: utf-8

n = int(input())
R = []

#input_value?????????
for i in range(n):
    R.append(int(input()))

max_dif = -2000000000
min_value = R[0]

for i in range(1, n):
    max_dif = max(max_dif, R[i] - min_value)
    min_value = min(min_value, R[i])

print(max_dif) 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_dif = -2000000000 max_dif -2000000000 min_value = R[0] min_value R[0] R 0 for i in range(1, n):
    max_dif = max(max_dif, R[i] - min_value)
    min_value = min(min_value, R[i]) i range(1, n) range 1 n max_dif = max(max_dif, R[i] - min_value) max_dif max(max_dif, R[i] - min_value) max max_dif R[i] - min_value R[i] R i min_value min_value = min(min_value, R[i]) min_value min(min_value, R[i]) min min_value R[i] R i print(max_dif) print max_dif max_dif = max(max_dif, R[i] - min_value) max(max_dif, R[i] - min_value) max_dif n = int(input()) int(input()) n max_dif = -2000000000 -2000000000 max_dif R = [] [] R min_value = R[0] R[0] min_value min_value = min(min_value, R[i]) min(min_value, R[i]) min_value
#coding: utf-8

n = int(input())
R = []

#input_value?????????
for i in range(n):
    R.append(int(input()))

max_dif = -2000000000
min_value = R[0]

for i in range(1, n):
    max_dif = max(max_dif, R[i] - min_value)
    min_value = min(min_value, R[i])

print(max_dif)