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

min = r[0]
max = -10 ** 12

for j in r[1:]:
    if j - min > max:
        max = j - min
    if min > j:
        min = j

print(max) 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 min = r[0] min r[0] r 0 max = -10 ** 12 max -10 ** 12 -10 12 for j in r[1:]:
    if j - min > max:
        max = j - min
    if min > j:
        min = j j r[1:] r 1: 1 if j - min > max:
        max = j - min
     j - min > max j - min j min max max = j - min max j - min j min if min > j:
        min = j min > j min j min = j min j print(max) print max r = [] [] r max = j - min j - min max min = j j min min = r[0] r[0] min n = int(input()) int(input()) n max = -10 ** 12 -10 ** 12 max
n = int(input())
r = []
for i in range(n):
    r.append(int(input()))

min = r[0]
max = -10 ** 12

for j in r[1:]:
    if j - min > max:
        max = j - min
    if min > j:
        min = j

print(max)