#include <bits/stdc++.h>
using namespace std;
string s;
string strd(int n) {
  string x;
  while (n) {
    int d = n % 10;
    x += (d + '0');
    n /= 10;
  }
  reverse(x.begin(), x.end());
  return x;
}
void digit() {
  cin >> s;
  long long sum = 0;
  for (int i = 0; i < s.size(); i++) {
    char a = (char)s[i];
    int d = (int)a - '0';
    sum += d;
  }
  if (sum % 9 == 0)
    cout << "Yes\n";
  else
    cout << "No\n";
}
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long d = INT_MIN;
  for (int i = 1; i < n; i++) {
    d = max(d, a[i] - a[i - 1]);
  }
  cout << d << endl;
}
