#include #define rep(i,n) for(int i=0;i<(int)n;i++) using namespace std; using ll = long long; using P = pair; int main() { ll x, y, d; cin >> x >> y >> d; x = min(x, d), y = min(y, d); cout << max((ll)0, min(d + 1, x + y + 1 - d)) << endl; return 0; }