datas = $stdin.read.split("\n")
n = datas[0].to_i
k = 0
profit = 0
max_profit = datas[2].to_i - datas[1].to_i
for i in 1..n do
  for j in 1..n - 1 - k do
    profit = datas[i + j].to_i - datas[i].to_i
    max_profit = profit if profit > max_profit
  end
  k += 1
end
puts max_profit
