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

maxv = R[1] - R[0]
minv = R[0]
for j in range(1, n):
    maxv = max(R[j] - minv, maxv)
    minv = min(R[j],minv)
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 = R[1] - R[0] maxv R[1] - R[0] R[1] R 1 R[0] R 0 minv = R[0] minv R[0] R 0 for j in range(1, n):
    maxv = max(R[j] - minv, maxv)
    minv = min(R[j],minv) j range(1, n) range 1 n maxv = max(R[j] - minv, maxv) maxv max(R[j] - minv, maxv) max R[j] - minv R[j] R j minv maxv minv = min(R[j],minv) minv min(R[j],minv) min R[j] R j minv print(maxv) print maxv minv = min(R[j],minv) min(R[j],minv) minv R = [] [] R maxv = max(R[j] - minv, maxv) max(R[j] - minv, maxv) maxv n = int(input()) int(input()) n minv = R[0] R[0] minv maxv = R[1] - R[0] R[1] - R[0] maxv
n = int(input())
R = []
for _ in range(n):
    R.append(int(input()))

maxv = R[1] - R[0]
minv = R[0]
for j in range(1, n):
    maxv = max(R[j] - minv, maxv)
    minv = min(R[j],minv)
print(maxv)