//#include #include #include #include #include #include #include #include // string, to_string, stoi #include // vector #include // min, max, swap, sort, reverse, lower_bound, upper_bound #include // pair, make_pair #include // tuple, make_tuple #include // int64_t, int*_t #include // printf #include // map #include // queue, priority_queue #include // set #include // stack #include // deque #include // unordered_map #include // unordered_set #include // bitset #include // isupper, islower, isdigit, toupper, tolower using namespace std; //using namespace atcoder; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using Graph = vector>; vector, vector>, greater>>> edge; vector seen; vll AN; ll p = 1; ll N; void dfs(const Graph & G, int v) { seen[v] = true; // v を訪問済にする AN[v] = p; // v から行ける各頂点 next_v について while (!edge[v].empty()) { ll next_v = edge[v].top().second; edge[v].pop(); if (seen[next_v]) continue; // next_v が探索済だったらスルー p++; dfs(G, next_v); // 再帰的に探索 p++; } } vll kB; ll j = 0; ll tt = 0; void predfs(const Graph& G, int v) { tt++; seen[v] = true; // v を訪問済にする AN[v] = p; ll now = tt; j++; // v から行ける各頂点 next_v について ll pe = 0; for (auto next_v : G[v]) { pe++; if (seen[next_v]) continue; // next_v が探索済だったらスルー /*if (pe == G[v].size()) { edge[v].push(make_pair(N-now, next_v)); }*/ ll M = j; predfs(G, next_v); // 再帰的に探索 edge[v].push(make_pair(j - M, next_v)); } } int main() { ll X, Y, D; cin >> X >> Y >> D; if (X < Y)swap(X, Y); if (D <= Y) { cout << D+1 << endl; } else if (D <= X) { cout << Y + 1 << endl; } else if(D<=X+Y){ cout << Y-(D-X)+1; } else { cout << 0 << endl; } }