n = raw_input()
n = int(n)
minv = raw_input()
minv = int(minv)
maxv = -1000000000
  
for j in range(n-1):
  num = raw_input()
  num = int(num)  
  diff = num - minv
  if maxv < diff:
    maxv = diff
  if num < minv:
    minv = num
  
print maxv n = raw_input() n raw_input() raw_input n = int(n) n int(n) int n minv = raw_input() minv raw_input() raw_input minv = int(minv) minv int(minv) int minv maxv = -1000000000 maxv -1000000000 for j in range(n-1):
  num = raw_input()
  num = int(num)  
  diff = num - minv
  if maxv < diff:
    maxv = diff
  if num < minv:
    minv = num
   j range(n-1) range n-1 n 1 num = raw_input() num raw_input() raw_input num = int(num) num int(num) int num diff = num - minv diff num - minv num minv if maxv < diff:
    maxv = diff
   maxv < diff maxv diff maxv = diff maxv diff if num < minv:
    minv = num
   num < minv num minv minv = num minv num print maxv = diff diff maxv n = raw_input() raw_input() n minv = int(minv) int(minv) minv num = raw_input() raw_input() num diff = num - minv num - minv diff num = int(num) int(num) num n = int(n) int(n) n maxv = -1000000000 -1000000000 maxv minv = raw_input() raw_input() minv minv = num num minv
n = raw_input()
n = int(n)
minv = raw_input()
minv = int(minv)
maxv = -1000000000
  
for j in range(n-1):
  num = raw_input()
  num = int(num)  
  diff = num - minv
  if maxv < diff:
    maxv = diff
  if num < minv:
    minv = num
  
print maxv