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

maxR = R[1]
minR = R[0]
maxB = R[1] - R[0]
for i in range(1,n):
 if R[i] < minR:
  minR = R[i]
  maxR = R[i] - 1
 elif minR <= R[i] and R[i] <= maxR:
  continue
 else:
  maxR = R[i]
  if maxR - minR > maxB:
   maxB = maxR - minR

print(str(maxB)) n = int(input()) n int(input()) int input() input R =[] R [] for i in range(n):
 R.append(int(input())) i range(n) range n R.append(int(input())) R.append R append int(input()) int input() input maxR = R[1] maxR R[1] R 1 minR = R[0] minR R[0] R 0 maxB = R[1] - R[0] maxB R[1] - R[0] R[1] R 1 R[0] R 0 for i in range(1,n):
 if R[i] < minR:
  minR = R[i]
  maxR = R[i] - 1
 elif minR <= R[i] and R[i] <= maxR:
  continue
 else:
  maxR = R[i]
  if maxR - minR > maxB:
   maxB = maxR - minR i range(1,n) range 1 n if R[i] < minR:
  minR = R[i]
  maxR = R[i] - 1
 elif minR <= R[i] and R[i] <= maxR:
  continue
 else:
  maxR = R[i]
  if maxR - minR > maxB:
   maxB = maxR - minR R[i] < minR R[i] R i minR minR = R[i] minR R[i] R i maxR = R[i] - 1 maxR R[i] - 1 R[i] R i 1 elif minR <= R[i] and R[i] <= maxR:
  continue
  minR <= R[i] and R[i] <= maxR minR <= R[i] minR R[i] R i R[i] <= maxR R[i] R i maxR continue maxR = R[i] maxR R[i] R i if maxR - minR > maxB:
   maxB = maxR - minR maxR - minR > maxB maxR - minR maxR minR maxB maxB = maxR - minR maxB maxR - minR maxR minR print(str(maxB)) print str(maxB) str maxB maxR = R[1] R[1] maxR maxB = maxR - minR maxR - minR maxB maxR = R[i] R[i] maxR n = int(input()) int(input()) n minR = R[0] R[0] minR maxR = R[i] - 1 R[i] - 1 maxR maxB = R[1] - R[0] R[1] - R[0] maxB R =[] [] R minR = R[i] R[i] minR
n = int(input())
R =[]
for i in range(n):
 R.append(int(input()))

maxR = R[1]
minR = R[0]
maxB = R[1] - R[0]
for i in range(1,n):
 if R[i] < minR:
  minR = R[i]
  maxR = R[i] - 1
 elif minR <= R[i] and R[i] <= maxR:
  continue
 else:
  maxR = R[i]
  if maxR - minR > maxB:
   maxB = maxR - minR

print(str(maxB))