dif_max = 1-10**9
min = 10**9
n_max = 0
n_max = int(raw_input())
 
price = [0]*n_max
for i in range(0, n_max):
  price[i] = int(raw_input())
for i in range(0, n_max-1):
  if min >= price[i]:
      min = price[i]
  if dif_max <= price[i+1] - min:
      dif_max = price[i+1] - min
print dif_max dif_max = 1-10**9 dif_max 1-10**9 1 10**9 10 9 min = 10**9 min 10**9 10 9 n_max = 0 n_max 0 n_max = int(raw_input()) n_max int(raw_input()) int raw_input() raw_input price = [0]*n_max price [0]*n_max [0] 0 n_max for i in range(0, n_max):
  price[i] = int(raw_input()) i range(0, n_max) range 0 n_max price[i] = int(raw_input()) price[i] price i int(raw_input()) int raw_input() raw_input for i in range(0, n_max-1):
  if min >= price[i]:
      min = price[i]
  if dif_max <= price[i+1] - min:
      dif_max = price[i+1] - min i range(0, n_max-1) range 0 n_max-1 n_max 1 if min >= price[i]:
      min = price[i]
   min >= price[i] min price[i] price i min = price[i] min price[i] price i if dif_max <= price[i+1] - min:
      dif_max = price[i+1] - min dif_max <= price[i+1] - min dif_max price[i+1] - min price[i+1] price i+1 i 1 min dif_max = price[i+1] - min dif_max price[i+1] - min price[i+1] price i+1 i 1 min print n_max = int(raw_input()) int(raw_input()) n_max dif_max = price[i+1] - min price[i+1] - min dif_max min = price[i] price[i] min dif_max = 1-10**9 1-10**9 dif_max min = 10**9 10**9 min price = [0]*n_max [0]*n_max price n_max = 0 0 n_max
dif_max = 1-10**9
min = 10**9
n_max = 0
n_max = int(raw_input())
 
price = [0]*n_max
for i in range(0, n_max):
  price[i] = int(raw_input())
for i in range(0, n_max-1):
  if min >= price[i]:
      min = price[i]
  if dif_max <= price[i+1] - min:
      dif_max = price[i+1] - min
print dif_max