n = int(input())
minv = int(input())
maxv = -2*10**9
for i in range(n-1):
    r = int(input())
    maxv = max(maxv,r-minv)
    minv = min(minv,r)
print(maxv) n = int(input()) n int(input()) int input() input minv = int(input()) minv int(input()) int input() input maxv = -2*10**9 maxv -2*10**9 -2 10**9 10 9 for i in range(n-1):
    r = int(input())
    maxv = max(maxv,r-minv)
    minv = min(minv,r) i range(n-1) range n-1 n 1 r = int(input()) r int(input()) int input() input maxv = max(maxv,r-minv) maxv max(maxv,r-minv) max maxv r-minv r minv minv = min(minv,r) minv min(minv,r) min minv r print(maxv) print maxv r = int(input()) int(input()) r n = int(input()) int(input()) n minv = min(minv,r) min(minv,r) minv minv = int(input()) int(input()) minv maxv = -2*10**9 -2*10**9 maxv maxv = max(maxv,r-minv) max(maxv,r-minv) maxv
n = int(input())
minv = int(input())
maxv = -2*10**9
for i in range(n-1):
    r = int(input())
    maxv = max(maxv,r-minv)
    minv = min(minv,r)
print(maxv)