n = int(raw_input())
maxprofit = -2 * 10 ** 9
minval = int(raw_input())
for _ in xrange(n-1):
  R = int(raw_input())
  maxprofit = max(maxprofit, R-minval)
  minval = min(minval, R)
print maxprofit n = int(raw_input()) n int(raw_input()) int raw_input() raw_input maxprofit = -2 * 10 ** 9 maxprofit -2 * 10 ** 9 -2 10 ** 9 10 9 minval = int(raw_input()) minval int(raw_input()) int raw_input() raw_input for _ in xrange(n-1):
  R = int(raw_input())
  maxprofit = max(maxprofit, R-minval)
  minval = min(minval, R) _ xrange(n-1) xrange n-1 n 1 R = int(raw_input()) R int(raw_input()) int raw_input() raw_input maxprofit = max(maxprofit, R-minval) maxprofit max(maxprofit, R-minval) max maxprofit R-minval R minval minval = min(minval, R) minval min(minval, R) min minval R print minval = min(minval, R) min(minval, R) minval n = int(raw_input()) int(raw_input()) n minval = int(raw_input()) int(raw_input()) minval maxprofit = max(maxprofit, R-minval) max(maxprofit, R-minval) maxprofit R = int(raw_input()) int(raw_input()) R maxprofit = -2 * 10 ** 9 -2 * 10 ** 9 maxprofit
n = int(raw_input())
maxprofit = -2 * 10 ** 9
minval = int(raw_input())
for _ in xrange(n-1):
  R = int(raw_input())
  maxprofit = max(maxprofit, R-minval)
  minval = min(minval, R)
print maxprofit