n = int(input())
R = [int(input()) for _ in range(n)]
minv, maxv = R[0], R[1]-R[0]
for j in range(1, n):
    maxv = max(maxv, R[j]-minv)
    minv = min(minv, R[j])
print(maxv) n = int(input()) n int(input()) int input() input int(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) int(input()) int input() input R = [int(input()) for _ in range(n)] R [int(input()) for _ in range(n)] minv, maxv = R[0], R[1]-R[0] minv R[0] R 0 maxv R[1]-R[0] R[1] R 1 R[0] R 0 for j in range(1, n):
    maxv = max(maxv, R[j]-minv)
    minv = min(minv, R[j]) j range(1, n) range 1 n maxv = max(maxv, R[j]-minv) maxv max(maxv, R[j]-minv) max maxv R[j]-minv R[j] R j minv minv = min(minv, R[j]) minv min(minv, R[j]) min minv R[j] R j print(maxv) print maxv n = int(input()) int(input()) n minv, maxv = R[0], R[1]-R[0] R[0] minv maxv = max(maxv, R[j]-minv) max(maxv, R[j]-minv) maxv maxv = R[0], R[1]-R[0] R[1]-R[0] maxv minv = min(minv, R[j]) min(minv, R[j]) minv R = [int(input()) for _ in range(n)] [int(input()) for _ in range(n)] R
n = int(input())
R = [int(input()) for _ in range(n)]
minv, maxv = R[0], R[1]-R[0]
for j in range(1, n):
    maxv = max(maxv, R[j]-minv)
    minv = min(minv, R[j])
print(maxv)