n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9  

for j in range(n-1):
    a = int(raw_input())
    b = a- minv
    if maxv < b:
       maxv = b 
    if minv > a:
       minv = a

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):
    a = int(raw_input())
    b = a- minv
    if maxv < b:
       maxv = b 
    if minv > a:
       minv = a j range(n-1) range n-1 n 1 a = int(raw_input()) a int(raw_input()) int raw_input() raw_input b = a- minv b a- minv a minv if maxv < b:
       maxv = b 
     maxv < b maxv b maxv = b maxv b if minv > a:
       minv = a minv > a minv a minv = a minv a print maxv = b b maxv a = int(raw_input()) int(raw_input()) a maxv = -1*10**9 -1*10**9 maxv minv = int(raw_input()) int(raw_input()) minv minv = a a minv n = int(raw_input()) int(raw_input()) n b = a- minv a- minv b
n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9  

for j in range(n-1):
    a = int(raw_input())
    b = a- minv
    if maxv < b:
       maxv = b 
    if minv > a:
       minv = a

print maxv