#include <iostream>
#include<vector>
#include<math.h>
using namespace std;

int maxProfit(vector<int>& v){
    int minn = 0x3f3f3f;
    int maxx = 0;
    for(int p : v){
        maxx = max(maxx, p - minn);
        minn = min(minn, p);
    }
    return maxx;
}

int main() {
    int x;
    vector<int> res;
    while (cin >> x) { // 注意 while 处理多个 case
        res.push_back(x);
    }
    int n = maxProfit(res);
    cout << n << endl;
    return 0;
}
// 64 位输出请用 printf("%lld")