#include using namespace std; int main(){ int a,b,c;cin >> a >> b >> c; int cost1 = 0,cost2 = 0; cost1 = b - max(a,c) + 1; cost2 = min(abs(a-c),min(abs(b-c),abs(a-b))); cout << min(cost1,cost2) << endl; }