n = input()
R = [0 for i in range(n)]
for i in range(n):
    R[i] = input()
maxv = -2000000000
minv = R[0]

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

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

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

print maxv