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

ans = data[1] - data[0]
x = data[0]

for d in data[1:]:
	ans = max(ans,d-x)
	x = min(d,x)

print(ans) n = int(input()) n int(input()) int input() input data = [] data [] data.append(int(input())) for i in range(n) for i in range(n) i range(n) range n for i in range(n) data.append(int(input())) data.append data append int(input()) int input() input [data.append(int(input())) for i in range(n)] ans = data[1] - data[0] ans data[1] - data[0] data[1] data 1 data[0] data 0 x = data[0] x data[0] data 0 for d in data[1:]:
	ans = max(ans,d-x)
	x = min(d,x) d data[1:] data 1: 1 ans = max(ans,d-x) ans max(ans,d-x) max ans d-x d x x = min(d,x) x min(d,x) min d x print(ans) print ans n = int(input()) int(input()) n ans = max(ans,d-x) max(ans,d-x) ans ans = data[1] - data[0] data[1] - data[0] ans x = min(d,x) min(d,x) x x = data[0] data[0] x data = [] [] data
n = int(input())
data = []
[data.append(int(input())) for i in range(n)]

ans = data[1] - data[0]
x = data[0]

for d in data[1:]:
	ans = max(ans,d-x)
	x = min(d,x)

print(ans)