#include #define rep(i,n) for(int i=0;i<(n);++i) #define all(a) (a).begin(),(a).end() #define dunk(a) cout << (a) << endl using namespace std; typedef long long ll; signed int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b, s; cin >> a >> b >> s; int ans = 0; if (abs(a - s) <= abs(b - s)) { ans += abs(a - s) + s; a = 1; s = 1; } else { ans += abs(b - s) + s; b = 1; s = 1; } ans += abs(a - s); dunk(ans); return 0; }