n = int(input())
maximum_profit = -10**9

r0 = int(input())
r_min = r0
for i in range(1, n):
    r1 = int(input())
    r_min = min(r0, r_min)
    maximum_profit = max(maximum_profit, r1 - r_min)
    r0 = r1
print(maximum_profit) n = int(input()) n int(input()) int input() input maximum_profit = -10**9 maximum_profit -10**9 -10 9 r0 = int(input()) r0 int(input()) int input() input r_min = r0 r_min r0 for i in range(1, n):
    r1 = int(input())
    r_min = min(r0, r_min)
    maximum_profit = max(maximum_profit, r1 - r_min)
    r0 = r1 i range(1, n) range 1 n r1 = int(input()) r1 int(input()) int input() input r_min = min(r0, r_min) r_min min(r0, r_min) min r0 r_min maximum_profit = max(maximum_profit, r1 - r_min) maximum_profit max(maximum_profit, r1 - r_min) max maximum_profit r1 - r_min r1 r_min r0 = r1 r0 r1 print(maximum_profit) print maximum_profit n = int(input()) int(input()) n maximum_profit = -10**9 -10**9 maximum_profit r_min = r0 r0 r_min r_min = min(r0, r_min) min(r0, r_min) r_min maximum_profit = max(maximum_profit, r1 - r_min) max(maximum_profit, r1 - r_min) maximum_profit r1 = int(input()) int(input()) r1 r0 = r1 r1 r0 r0 = int(input()) int(input()) r0
n = int(input())
maximum_profit = -10**9

r0 = int(input())
r_min = r0
for i in range(1, n):
    r1 = int(input())
    r_min = min(r0, r_min)
    maximum_profit = max(maximum_profit, r1 - r_min)
    r0 = r1
print(maximum_profit)