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