#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define llong long long int main() { uint x, y, d; cin >> x >> y >> d; bool left = y >= d; bool top = d > y && d <= x + y; bool right = d >= x && d <= x + y; bool bottom = d < x; if(left || top) { int x0, x1; x0 = left ? 0 : d - y; x1 = bottom ? d : y; cout << x1 - x0 + 1 << endl; } else { cout << 0 << endl; } }