n = int(input())

minr = float('inf')
maxd = -float('inf')
for _ in range(n):
    r = int(input())
    maxd = max(maxd, r - minr)

    minr = min(minr, r)

print(maxd) n = int(input()) n int(input()) int input() input minr = float('inf') minr float('inf') float 'inf' maxd = -float('inf') maxd -float('inf') float('inf') float 'inf' for _ in range(n):
    r = int(input())
    maxd = max(maxd, r - minr)

    minr = min(minr, r) _ range(n) range n r = int(input()) r int(input()) int input() input maxd = max(maxd, r - minr) maxd max(maxd, r - minr) max maxd r - minr r minr minr = min(minr, r) minr min(minr, r) min minr r print(maxd) print maxd n = int(input()) int(input()) n minr = float('inf') float('inf') minr maxd = max(maxd, r - minr) max(maxd, r - minr) maxd maxd = -float('inf') -float('inf') maxd r = int(input()) int(input()) r minr = min(minr, r) min(minr, r) minr
n = int(input())

minr = float('inf')
maxd = -float('inf')
for _ in range(n):
    r = int(input())
    maxd = max(maxd, r - minr)

    minr = min(minr, r)

print(maxd)
