n = int(input())
r = [int(input()) for i in range(n)]
start = r[0]
score = r[1] - r[0]
for i in range(1,n):
    if r[i] - start > score: score = r[i] - start
    if r[i] < start: start = r[i]
print(score) n = int(input()) n int(input()) int input() input int(input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(input()) int input() input r = [int(input()) for i in range(n)] r [int(input()) for i in range(n)] start = r[0] start r[0] r 0 score = r[1] - r[0] score r[1] - r[0] r[1] r 1 r[0] r 0 for i in range(1,n):
    if r[i] - start > score: score = r[i] - start
    if r[i] < start: start = r[i] i range(1,n) range 1 n if r[i] - start > score: score = r[i] - start
     r[i] - start > score r[i] - start r[i] r i start score if r[i] < start: start =  r[i] < start r[i] r i start print(score) print score start = r[0] r[0] start score = r[1] - r[0] r[1] - r[0] score r = [int(input()) for i in range(n)] [int(input()) for i in range(n)] r n = int(input()) int(input()) n
n = int(input())
r = [int(input()) for i in range(n)]
start = r[0]
score = r[1] - r[0]
for i in range(1,n):
    if r[i] - start > score: score = r[i] - start
    if r[i] < start: start = r[i]
print(score)