#include #include #include #include #include #include using namespace std; int main(){ vector a(3,0); cin >> a[0] >> a[1] >> a[2]; sort(a.begin(),a.end()); int down_cost=a[2]-a[1]+1; int up_cost=a[1]-a[0]; cout << min(down_cost,up_cost) << endl; return 0; }