#include #include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main(){ int x, y, d, min1 = -1, max1 = 1e9 + 1; cin >> x >> y >> d; min1 = min(x, y); max1 = max(x, y); if (d <= min1) cout << d + 1 << endl; else if (min1 < d && d <= max1) cout << min1 + 1 << endl; else if (max1 < d && d <= max1 + min1) cout << max1 + min1 - d << endl; else cout << 0 << endl; }