n = int(input())
minv = int(input())
maxv = (10**9)*(-1)
for j in range(1,n):
    r = int(input())
    if maxv < (r - minv):
        maxv = r - minv
    if minv > r:
        minv = r
print(maxv) n = int(input()) n int(input()) int input() input minv = int(input()) minv int(input()) int input() input maxv = (10**9)*(-1) maxv (10**9)*(-1) 10**9 10 9 -1 for j in range(1,n):
    r = int(input())
    if maxv < (r - minv):
        maxv = r - minv
    if minv > r:
        minv = r j range(1,n) range 1 n r = int(input()) r int(input()) int input() input if maxv < (r - minv):
        maxv = r - minv
     maxv < (r - minv) maxv r - minv r minv maxv = r - minv maxv r - minv r minv if minv > r:
        minv = r minv > r minv r minv = r minv r print(maxv) print maxv n = int(input()) int(input()) n maxv = r - minv r - minv maxv maxv = (10**9)*(-1) (10**9)*(-1) maxv r = int(input()) int(input()) r minv = int(input()) int(input()) minv minv = r r minv
n = int(input())
minv = int(input())
maxv = (10**9)*(-1)
for j in range(1,n):
    r = int(input())
    if maxv < (r - minv):
        maxv = r - minv
    if minv > r:
        minv = r
print(maxv)