N=int(raw_input())
max=(-1)*(10**9)
x1=input()
min=x1

for i in range(N-1):
  x=int(raw_input())

  if max < x-min:
    max=x-min
  if min>x:
    min=x
print max N=int(raw_input()) N int(raw_input()) int raw_input() raw_input max=(-1)*(10**9) max (-1)*(10**9) -1 10**9 10 9 x1=input() x1 input() input min=x1 min x1 for i in range(N-1):
  x=int(raw_input())

  if max < x-min:
    max=x-min
  if min>x:
    min=x i range(N-1) range N-1 N 1 x=int(raw_input()) x int(raw_input()) int raw_input() raw_input if max < x-min:
    max=x-min
   max < x-min max x-min x min max=x-min max x-min x min if min>x:
    min=x min>x min x min=x min x print N=int(raw_input()) int(raw_input()) N min=x x min x1=input() input() x1 max=(-1)*(10**9) (-1)*(10**9) max x=int(raw_input()) int(raw_input()) x min=x1 x1 min max=x-min x-min max
N=int(raw_input())
max=(-1)*(10**9)
x1=input()
min=x1

for i in range(N-1):
  x=int(raw_input())

  if max < x-min:
    max=x-min
  if min>x:
    min=x
print max