#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m = -1, r[200005];
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &r[i]);
    if (i > 1) m = max(r[i] - r[i - 1], m);
  }
  printf("%d", m);
}
