n = int( raw_input( ) )
minv = int( raw_input( ) )
maxv = 0 - 1000000000
 
for j in range( n-1 ):
  num = int( raw_input( ) )  
  diff = num - minv
  if maxv < diff:
    maxv = diff
  if num < minv:
    minv = num
 
print maxv n = int( raw_input( ) ) n int( raw_input( ) ) int raw_input( ) raw_input minv = int( raw_input( ) ) minv int( raw_input( ) ) int raw_input( ) raw_input maxv = 0 - 1000000000 maxv 0 - 1000000000 0 1000000000 for j in range( n-1 ):
  num = int( raw_input( ) )  
  diff = num - minv
  if maxv < diff:
    maxv = diff
  if num < minv:
    minv = num
  j range( n-1 ) range n-1 n 1 num = int( raw_input( ) ) num int( raw_input( ) ) int raw_input( ) raw_input 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 minv = int( raw_input( ) ) int( raw_input( ) ) minv minv = num num minv diff = num - minv num - minv diff maxv = 0 - 1000000000 0 - 1000000000 maxv n = int( raw_input( ) ) int( raw_input( ) ) n num = int( raw_input( ) ) int( raw_input( ) ) num
n = int( raw_input( ) )
minv = int( raw_input( ) )
maxv = 0 - 1000000000
 
for j in range( n-1 ):
  num = int( raw_input( ) )  
  diff = num - minv
  if maxv < diff:
    maxv = diff
  if num < minv:
    minv = num
 
print maxv