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

maxv = -2 * 10**9
minv = r[0]

for ri in r[1:]:
    maxv = max(maxv, ri - minv)
    minv = min(minv, ri)

print(maxv) n = int(input()) n int(input()) int input() input r = [] r [] for _ in range(n):
    r.append(int(input())) _ range(n) range n r.append(int(input())) r.append r append int(input()) int input() input maxv = -2 * 10**9 maxv -2 * 10**9 -2 10**9 10 9 minv = r[0] minv r[0] r 0 for ri in r[1:]:
    maxv = max(maxv, ri - minv)
    minv = min(minv, ri) ri r[1:] r 1: 1 maxv = max(maxv, ri - minv) maxv max(maxv, ri - minv) max maxv ri - minv ri minv minv = min(minv, ri) minv min(minv, ri) min minv ri print(maxv) print maxv r = [] [] r maxv = -2 * 10**9 -2 * 10**9 maxv n = int(input()) int(input()) n minv = r[0] r[0] minv minv = min(minv, ri) min(minv, ri) minv maxv = max(maxv, ri - minv) max(maxv, ri - minv) maxv
n = int(input())
r = []
for _ in range(n):
    r.append(int(input()))

maxv = -2 * 10**9
minv = r[0]

for ri in r[1:]:
    maxv = max(maxv, ri - minv)
    minv = min(minv, ri)

print(maxv)
