n = int(input())
R = list()

for _ in range(n):
    R.append(int(input()))

ans = R[1] - R[0]
min_R = R[0]

for i in range(1, n):
    ans   = max(ans, R[i] - min_R)
    min_R = min(min_R, R[i])
print(ans) n = int(input()) n int(input()) int input() input R = list() R list() list for _ in range(n):
    R.append(int(input())) _ range(n) range n R.append(int(input())) R.append R append int(input()) int input() input ans = R[1] - R[0] ans R[1] - R[0] R[1] R 1 R[0] R 0 min_R = R[0] min_R R[0] R 0 for i in range(1, n):
    ans   = max(ans, R[i] - min_R)
    min_R = min(min_R, R[i]) i range(1, n) range 1 n ans   = max(ans, R[i] - min_R) ans max(ans, R[i] - min_R) max ans R[i] - min_R R[i] R i min_R min_R = min(min_R, R[i]) min_R min(min_R, R[i]) min min_R R[i] R i print(ans) print ans ans   = max(ans, R[i] - min_R) max(ans, R[i] - min_R) ans min_R = R[0] R[0] min_R min_R = min(min_R, R[i]) min(min_R, R[i]) min_R n = int(input()) int(input()) n R = list() list() R ans = R[1] - R[0] R[1] - R[0] ans
n = int(input())
R = list()

for _ in range(n):
    R.append(int(input()))

ans = R[1] - R[0]
min_R = R[0]

for i in range(1, n):
    ans   = max(ans, R[i] - min_R)
    min_R = min(min_R, R[i])
print(ans)