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