#include <bits/stdc++.h>
using namespace std;
int ans;
int main() {
  int i, s, last, n;
  scanf("%d %d", &n, &s);
  last = s;
  for (i = 1; i < n; i++) {
    scanf("%d", &s);
    int cha = s - last;
    ans = max(ans, cha);
    last = s;
  }
  printf("%d", ans);
  return 0;
}
