n = int(input())
ls = [int(input()) for _ in range(n)]

result = []
biggest = 0
for i in range(n-1):
    last = ls.pop()
    if last > biggest:
        biggest = last
        result.append(last - min(ls))
print(max(result)) 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 ls = [int(input()) for _ in range(n)] ls [int(input()) for _ in range(n)] result = [] result [] biggest = 0 biggest 0 for i in range(n-1):
    last = ls.pop()
    if last > biggest:
        biggest = last
        result.append(last - min(ls)) i range(n-1) range n-1 n 1 last = ls.pop() last ls.pop() ls.pop ls pop if last > biggest:
        biggest = last
        result.append(last - min(ls)) last > biggest last biggest biggest = last biggest last result.append(last - min(ls)) result.append result append last - min(ls) last min(ls) min ls print(max(result)) print max(result) max result result = [] [] result ls = [int(input()) for _ in range(n)] [int(input()) for _ in range(n)] ls biggest = 0 0 biggest biggest = last last biggest n = int(input()) int(input()) n last = ls.pop() ls.pop() last
n = int(input())
ls = [int(input()) for _ in range(n)]

result = []
biggest = 0
for i in range(n-1):
    last = ls.pop()
    if last > biggest:
        biggest = last
        result.append(last - min(ls))
print(max(result))
