#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if(a == b) {
    cout << c << endl;
  }
  else if(b == c) {
    cout << a << endl;
  }
  else if(c == a) {
    cout << b << endl;
  }
  else {
    cout << 0 << endl;
  }
}
  
#include <iostream>

using namespace std;
int a, b, c, d, resta_max;
int main()
{
    cin>>a>>b>>c>>d;
    resta_max=max(max(a-c, max(a-d, b-c)), b-d);
    cout<<resta_max;
    return 0;
}
