#include #include #include #include #include #include using namespace std; int main(){ long long a,b,c; cin >> a >> b >> c; long long mid=max(a,c); long long mi=min(a,c); long long cost=min((b-mid),(mid-mi)); cout << cost << endl; return 0; }