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