n = int(input())
R = [int(input()) for _ in range(n)]
ans = R[1] - R[0]
bottom = min(R[0], R[1])
for i in range(2, n):
    ans = max(ans, R[i] - bottom)
    if R[i] < bottom:
        bottom = R[i]
print(ans) 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)] ans = R[1] - R[0] ans R[1] - R[0] R[1] R 1 R[0] R 0 bottom = min(R[0], R[1]) bottom min(R[0], R[1]) min R[0] R 0 R[1] R 1 for i in range(2, n):
    ans = max(ans, R[i] - bottom)
    if R[i] < bottom:
        bottom = R[i] i range(2, n) range 2 n ans = max(ans, R[i] - bottom) ans max(ans, R[i] - bottom) max ans R[i] - bottom R[i] R i bottom if R[i] < bottom:
        bottom = R[i] R[i] < bottom R[i] R i bottom bottom = R[i] bottom R[i] R i print(ans) print ans n = int(input()) int(input()) n bottom = min(R[0], R[1]) min(R[0], R[1]) bottom R = [int(input()) for _ in range(n)] [int(input()) for _ in range(n)] R ans = max(ans, R[i] - bottom) max(ans, R[i] - bottom) ans bottom = R[i] R[i] bottom ans = R[1] - R[0] R[1] - R[0] ans
n = int(input())
R = [int(input()) for _ in range(n)]
ans = R[1] - R[0]
bottom = min(R[0], R[1])
for i in range(2, n):
    ans = max(ans, R[i] - bottom)
    if R[i] < bottom:
        bottom = R[i]
print(ans)