N=input()
input = [int(input()) for i in range(int(N))]
maxv=-10000000000
minv=10000000000
for i,x in enumerate(input):
	maxv = max(maxv, input[i]-minv)
	minv = min(minv, input[i])
print(maxv) N=input() N input() input int(input()) for i in range(int(N)) for i in range(int(N)) i range(int(N)) range int(N) int N for i in range(int(N)) int(input()) int input() input input = [int(input()) for i in range(int(N))] input [int(input()) for i in range(int(N))] maxv=-10000000000 maxv -10000000000 minv=10000000000 minv 10000000000 for i,x in enumerate(input):
	maxv = max(maxv, input[i]-minv)
	minv = min(minv, input[i]) i x enumerate(input) enumerate input maxv = max(maxv, input[i]-minv) maxv max(maxv, input[i]-minv) max maxv input[i]-minv input[i] input i minv minv = min(minv, input[i]) minv min(minv, input[i]) min minv input[i] input i print(maxv) print maxv N=input() input() N input = [int(input()) for i in range(int(N))] [int(input()) for i in range(int(N))] input minv = min(minv, input[i]) min(minv, input[i]) minv minv=10000000000 10000000000 minv maxv = max(maxv, input[i]-minv) max(maxv, input[i]-minv) maxv maxv=-10000000000 -10000000000 maxv
N=input()
input = [int(input()) for i in range(int(N))]
maxv=-10000000000
minv=10000000000
for i,x in enumerate(input):
	maxv = max(maxv, input[i]-minv)
	minv = min(minv, input[i])
print(maxv)