# coding: utf-8

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

MIN = R[0]
MAXdiff = R[1]-R[0]

for i in range(1,n):
    MAXdiff = max(MAXdiff,R[i]-MIN)
    MIN = min(MIN,R[i])

print(MAXdiff) 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 R = [ int(input()) for i in range(n)] R [ int(input()) for i in range(n)] MIN = R[0] MIN R[0] R 0 MAXdiff = R[1]-R[0] MAXdiff R[1]-R[0] R[1] R 1 R[0] R 0 for i in range(1,n):
    MAXdiff = max(MAXdiff,R[i]-MIN)
    MIN = min(MIN,R[i]) i range(1,n) range 1 n MAXdiff = max(MAXdiff,R[i]-MIN) MAXdiff max(MAXdiff,R[i]-MIN) max MAXdiff R[i]-MIN R[i] R i MIN MIN = min(MIN,R[i]) MIN min(MIN,R[i]) min MIN R[i] R i print(MAXdiff) print MAXdiff MIN = min(MIN,R[i]) min(MIN,R[i]) MIN n = int(input()) int(input()) n MIN = R[0] R[0] MIN R = [ int(input()) for i in range(n)] [ int(input()) for i in range(n)] R MAXdiff = R[1]-R[0] R[1]-R[0] MAXdiff MAXdiff = max(MAXdiff,R[i]-MIN) max(MAXdiff,R[i]-MIN) MAXdiff
# coding: utf-8

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

MIN = R[0]
MAXdiff = R[1]-R[0]

for i in range(1,n):
    MAXdiff = max(MAXdiff,R[i]-MIN)
    MIN = min(MIN,R[i])

print(MAXdiff)
