n = int(input())

# initial observation
cur_min = int(input())
max_diff = -1 * (10**9) - 1

for i in range(n - 1) :
    num = int(input())
    
    max_diff = max(max_diff, num - cur_min)
    
    if num < cur_min :
        cur_min = num
    
print(max_diff) n = int(input()) n int(input()) int input() input cur_min = int(input()) cur_min int(input()) int input() input max_diff = -1 * (10**9) - 1 max_diff -1 * (10**9) - 1 -1 * (10**9) -1 10**9 10 9 1 for i in range(n - 1) :
    num = int(input())
    
    max_diff = max(max_diff, num - cur_min)
    
    if num < cur_min :
        cur_min = num
     i range(n - 1) range n - 1 n 1 num = int(input()) num int(input()) int input() input max_diff = max(max_diff, num - cur_min) max_diff max(max_diff, num - cur_min) max max_diff num - cur_min num cur_min if num < cur_min :
        cur_min = num
     num < cur_min num cur_min cur_min = num cur_min num print(max_diff) print max_diff num = int(input()) int(input()) num n = int(input()) int(input()) n max_diff = -1 * (10**9) - 1 -1 * (10**9) - 1 max_diff cur_min = num num cur_min cur_min = int(input()) int(input()) cur_min max_diff = max(max_diff, num - cur_min) max(max_diff, num - cur_min) max_diff
n = int(input())

# initial observation
cur_min = int(input())
max_diff = -1 * (10**9) - 1

for i in range(n - 1) :
    num = int(input())
    
    max_diff = max(max_diff, num - cur_min)
    
    if num < cur_min :
        cur_min = num
    
print(max_diff)
