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

# R???i???????????§???????°???????i?????????????´???¨???????????????list
mins = [R[0]]
for i in range(1, n):
    mins.append(min(R[i], mins[i-1]))

# ???????????????j????????????????????\??????????°??????¨??????????±?????????????????????§???????±????????????????
mx = - 10 ** 12
for j in range(1, n):
    mx = max(mx, R[j] - mins[j-1])

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

# R???i???????????§???????°???????i?????????????´???¨???????????????list i range(n) range n R.append(int(input())) R.append R append int(input()) int input() input mins = [R[0]] mins [R[0]] R[0] R 0 for i in range(1, n):
    mins.append(min(R[i], mins[i-1]))

# ???????????????j????????????????????\??????????°??????¨??????????±?????????????????????§???????±???????????????? i range(1, n) range 1 n mins.append(min(R[i], mins[i-1])) mins.append mins append min(R[i], mins[i-1]) min R[i] R i mins[i-1] mins i-1 i 1 mx = - 10 ** 12 mx - 10 ** 12 - 10 12 for j in range(1, n):
    mx = max(mx, R[j] - mins[j-1]) j range(1, n) range 1 n mx = max(mx, R[j] - mins[j-1]) mx max(mx, R[j] - mins[j-1]) max mx R[j] - mins[j-1] R[j] R j mins[j-1] mins j-1 j 1 print(mx) print mx mins = [R[0]] [R[0]] mins n = int(input()) int(input()) n mx = max(mx, R[j] - mins[j-1]) max(mx, R[j] - mins[j-1]) mx mx = - 10 ** 12 - 10 ** 12 mx R = [] [] R
n = int(input())
R = []
for i in range(n):
    R.append(int(input()))

# R???i???????????§???????°???????i?????????????´???¨???????????????list
mins = [R[0]]
for i in range(1, n):
    mins.append(min(R[i], mins[i-1]))

# ???????????????j????????????????????\??????????°??????¨??????????±?????????????????????§???????±????????????????
mx = - 10 ** 12
for j in range(1, n):
    mx = max(mx, R[j] - mins[j-1])

print(mx)