
n = int(input())

R = []

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

minv = R[0]
maxv = R[1] - R[0]

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

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

n = int(input())

R = []

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

minv = R[0]
maxv = R[1] - R[0]

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

print(maxv)