n = int(input())
R = [int(input()) for i in range(n)]
maxv = R[1] - R[0]
minv = R[0]

for j in range(1, n):
    maxv = R[j] - minv if R[j] - minv > maxv else maxv
    minv = R[j] if R[j] < minv else minv

print(maxv) n = int(input()) n int(input()) int input() input int(input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(input()) int input() input R = [int(input()) for i in range(n)] R [int(input()) for i in range(n)] maxv = R[1] - R[0] maxv R[1] - R[0] R[1] R 1 R[0] R 0 minv = R[0] minv R[0] R 0 for j in range(1, n):
    maxv = R[j] - minv if R[j] - minv > maxv else maxv
    minv = R[j] if R[j] < minv else minv j range(1, n) range 1 n maxv = R[j] - minv if R[j] - minv > maxv else maxv maxv R[j] - minv if R[j] - minv > maxv else maxv R[j] - minv > maxv R[j] - minv R[j] R j minv maxv R[j] - minv R[j] R j minv maxv minv = R[j] if R[j] < minv else minv minv R[j] if R[j] < minv else minv R[j] < minv R[j] R j minv R[j] R j minv print(maxv) print maxv R = [int(input()) for i in range(n)] [int(input()) for i in range(n)] R n = int(input()) int(input()) n maxv = R[j] - minv if R[j] - minv > maxv else maxv R[j] - minv if R[j] - minv > maxv else maxv maxv minv = R[j] if R[j] < minv else minv R[j] if R[j] < minv else minv minv minv = R[0] R[0] minv maxv = R[1] - R[0] R[1] - R[0] maxv
n = int(input())
R = [int(input()) for i in range(n)]
maxv = R[1] - R[0]
minv = R[0]

for j in range(1, n):
    maxv = R[j] - minv if R[j] - minv > maxv else maxv
    minv = R[j] if R[j] < minv else minv

print(maxv)