#include <iostream>
using namespace std;
int main() {
int a, b, c;
int x;
cin >> a >> b >> c;
if (a > b && b > c && b < a) {
x = a - c - 2;
cout << x;
} else if (a > b && b < c && c < a) {
x = a - b - 2;
cout << x;
} else if (b > a && a > c && a < b) {
x = b - c - 2;
cout << x;
} else if (b > a && a < c && c < b) {
x = b - a - 2;
cout << x;
} else if (c > a && a > b && a < c) {
x = c - b - 2;
cout << x;
} else {
x = c - a - 2;
cout << x;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgYSwgYiwgYzsKCWludCB4OwoJY2luID4+IGEgPj4gYiA+PiBjOwoJaWYgKGEgPiBiICYmIGIgPiBjICYmIGIgPCBhKSB7CgkJeCA9IGEgLSBjIC0gMjsKCQljb3V0IDw8IHg7Cgl9IGVsc2UgaWYgKGEgPiBiICYmIGIgPCBjICYmIGMgPCBhKSB7CgkJeCA9IGEgLSBiIC0gMjsKCQljb3V0IDw8IHg7Cgl9IGVsc2UgaWYgKGIgPiBhICYmIGEgPiBjICYmIGEgPCBiKSB7CgkJeCA9IGIgLSBjIC0gMjsKCQljb3V0IDw8IHg7Cgl9IGVsc2UgaWYgKGIgPiBhICYmIGEgPCBjICYmIGMgPCBiKSB7CgkJeCA9IGIgLSBhIC0gMjsKCQljb3V0IDw8IHg7Cgl9IGVsc2UgaWYgKGMgPiBhICYmIGEgPiBiICYmIGEgPCBjKSB7CgkJeCA9IGMgLSBiIC0gMjsKCQljb3V0IDw8IHg7Cgl9IGVsc2UgewoJCXggPSBjIC0gYSAtIDI7CgkJY291dCA8PCB4OwoJfQoJcmV0dXJuIDA7Cn0=