#include #include using namespace std; int main() { unsigned int x, y, d; cin >> x >> y >> d; if (d <= min(x, y)) { cout << d + 1 << endl; } else if (d <= max(x, y)) { cout << min(x, y) + 1 << endl; } else if (d <= x + y) { cout << x + y + 1 - d << endl; } else { cout << 0 << endl; } return 0; }