n = int(raw_input())
num_list = [int(raw_input()) for i in xrange(n)]

minv = num_list[0]
maxv = -1000000000

for i in xrange(1, n):
  tmp = num_list[i] - minv
  maxv = tmp if tmp > maxv else maxv
  minv = num_list[i] if minv > num_list[i] else minv
  # print "i = %d, tmp = %d, maxv = %d, minv = %d" % (i, tmp, maxv, minv)

print maxv n = int(raw_input()) n int(raw_input()) int raw_input() raw_input int(raw_input()) for i in xrange(n) for i in xrange(n) i xrange(n) xrange n for i in xrange(n) int(raw_input()) int raw_input() raw_input num_list = [int(raw_input()) for i in xrange(n)] num_list [int(raw_input()) for i in xrange(n)] minv = num_list[0] minv num_list[0] num_list 0 maxv = -1000000000 maxv -1000000000 for i in xrange(1, n):
  tmp = num_list[i] - minv
  maxv = tmp if tmp > maxv else maxv
  minv = num_list[i] if minv > num_list[i] else minv
  # print "i = %d, tmp = %d, maxv = %d, minv = %d" % (i, tmp, maxv, minv) i xrange(1, n) xrange 1 n tmp = num_list[i] - minv tmp num_list[i] - minv num_list[i] num_list i minv maxv = tmp if tmp > maxv else maxv maxv tmp if tmp > maxv else maxv tmp > maxv tmp maxv tmp maxv minv = num_list[i] if minv > num_list[i] else minv minv num_list[i] if minv > num_list[i] else minv minv > num_list[i] minv num_list[i] num_list i num_list[i] num_list i minv print n = int(raw_input()) int(raw_input()) n num_list = [int(raw_input()) for i in xrange(n)] [int(raw_input()) for i in xrange(n)] num_list maxv = -1000000000 -1000000000 maxv tmp = num_list[i] - minv num_list[i] - minv tmp minv = num_list[0] num_list[0] minv maxv = tmp if tmp > maxv else maxv tmp if tmp > maxv else maxv maxv minv = num_list[i] if minv > num_list[i] else minv num_list[i] if minv > num_list[i] else minv minv
n = int(raw_input())
num_list = [int(raw_input()) for i in xrange(n)]

minv = num_list[0]
maxv = -1000000000

for i in xrange(1, n):
  tmp = num_list[i] - minv
  maxv = tmp if tmp > maxv else maxv
  minv = num_list[i] if minv > num_list[i] else minv
  # print "i = %d, tmp = %d, maxv = %d, minv = %d" % (i, tmp, maxv, minv)

print maxv