n = int(input())
data = [int(input()) for i in range(n)]

min_value = data.pop(0)
earn_value = -1000000000000
for d in data:
    earn_value = max(d - min_value, earn_value)
    min_value = min(d, min_value) 
print(earn_value) 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 data = [int(input()) for i in range(n)] data [int(input()) for i in range(n)] min_value = data.pop(0) min_value data.pop(0) data.pop data pop 0 earn_value = -1000000000000 earn_value -1000000000000 for d in data:
    earn_value = max(d - min_value, earn_value)
    min_value = min(d, min_value)  d data earn_value = max(d - min_value, earn_value) earn_value max(d - min_value, earn_value) max d - min_value d min_value earn_value min_value = min(d, min_value) min_value min(d, min_value) min d min_value print(earn_value) print earn_value min_value = data.pop(0) data.pop(0) min_value earn_value = max(d - min_value, earn_value) max(d - min_value, earn_value) earn_value n = int(input()) int(input()) n min_value = min(d, min_value) min(d, min_value) min_value earn_value = -1000000000000 -1000000000000 earn_value data = [int(input()) for i in range(n)] [int(input()) for i in range(n)] data
n = int(input())
data = [int(input()) for i in range(n)]

min_value = data.pop(0)
earn_value = -1000000000000
for d in data:
    earn_value = max(d - min_value, earn_value)
    min_value = min(d, min_value) 
print(earn_value)