const getMaxv = arr => {
  let j = 0;
  let maxv = -Infinity;
  for (j = 0; j < arr.length - 1; j++) {
    maxv = max(maxv, R[j] - min);
    min = min(minv, R[j]);
  }
  console.log(maxv);
};

process.stdin.resume();
process.stdin.setEncoding("utf8");
let input_string = "";

process.stdin.on("data", chunk => {
  input_string += chunk;
});

process.stdin.on("end", () => {
  const lines = input_string.split("\n");
  const lines = input_string.split("\n").filter(v => {
    return v !== "";
  });
  getMaxv(lines);
});

