n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9
  
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 = -1*10**9 maxv -1*10**9 -1 10**9 10 9 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 minv = int(raw_input()) int(raw_input()) minv num = int( raw_input( ) ) int( raw_input( ) ) num maxv = -1*10**9 -1*10**9 maxv n = int(raw_input()) int(raw_input()) n diff = num - minv num - minv diff minv = num num minv maxv = diff diff maxv
n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9
  
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