n = int(input().rstrip())
R = [0 for _ in range(n)]
for i in range(n):
    R[i] = int(input().rstrip())

margin = - 10**9
min_R = R[0]
for j in range(1, n):
    margin = max(margin, R[j] - min_R)
    min_R = min(min_R, R[j])

print(margin) n = int(input().rstrip()) n int(input().rstrip()) int input().rstrip() ().rstrip () input rstrip 0 for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) 0 R = [0 for _ in range(n)] R [0 for _ in range(n)] for i in range(n):
    R[i] = int(input().rstrip()) i range(n) range n R[i] = int(input().rstrip()) R[i] R i int(input().rstrip()) int input().rstrip() ().rstrip () input rstrip margin = - 10**9 margin - 10**9 - 10 9 min_R = R[0] min_R R[0] R 0 for j in range(1, n):
    margin = max(margin, R[j] - min_R)
    min_R = min(min_R, R[j]) j range(1, n) range 1 n margin = max(margin, R[j] - min_R) margin max(margin, R[j] - min_R) max margin R[j] - min_R R[j] R j min_R min_R = min(min_R, R[j]) min_R min(min_R, R[j]) min min_R R[j] R j print(margin) print margin margin = max(margin, R[j] - min_R) max(margin, R[j] - min_R) margin margin = - 10**9 - 10**9 margin n = int(input().rstrip()) int(input().rstrip()) n R = [0 for _ in range(n)] [0 for _ in range(n)] R min_R = R[0] R[0] min_R min_R = min(min_R, R[j]) min(min_R, R[j]) min_R
n = int(input().rstrip())
R = [0 for _ in range(n)]
for i in range(n):
    R[i] = int(input().rstrip())

margin = - 10**9
min_R = R[0]
for j in range(1, n):
    margin = max(margin, R[j] - min_R)
    min_R = min(min_R, R[j])

print(margin)
