num = raw_input()
num_list = []
for i in range(int(num)):
    a = raw_input()
    num_list.append(int(a))

min_ans = num_list[0]
max_ans = float("-inf")
for i in num_list[1:]:
    if i - min_ans > max_ans:
        max_ans = i - min_ans
    if i < min_ans:
        min_ans = i

print max_ans num = raw_input() num raw_input() raw_input num_list = [] num_list [] for i in range(int(num)):
    a = raw_input()
    num_list.append(int(a)) i range(int(num)) range int(num) int num a = raw_input() a raw_input() raw_input num_list.append(int(a)) num_list.append num_list append int(a) int a min_ans = num_list[0] min_ans num_list[0] num_list 0 max_ans = float("-inf") max_ans float("-inf") float "-inf" for i in num_list[1:]:
    if i - min_ans > max_ans:
        max_ans = i - min_ans
    if i < min_ans:
        min_ans = i i num_list[1:] num_list 1: 1 if i - min_ans > max_ans:
        max_ans = i - min_ans
     i - min_ans > max_ans i - min_ans i min_ans max_ans max_ans = i - min_ans max_ans i - min_ans i min_ans if i < min_ans:
        min_ans = i i < min_ans i min_ans min_ans = i min_ans i print a = raw_input() raw_input() a max_ans = float("-inf") float("-inf") max_ans min_ans = i i min_ans min_ans = num_list[0] num_list[0] min_ans max_ans = i - min_ans i - min_ans max_ans num = raw_input() raw_input() num num_list = [] [] num_list
num = raw_input()
num_list = []
for i in range(int(num)):
    a = raw_input()
    num_list.append(int(a))

min_ans = num_list[0]
max_ans = float("-inf")
for i in num_list[1:]:
    if i - min_ans > max_ans:
        max_ans = i - min_ans
    if i < min_ans:
        min_ans = i

print max_ans