#include using lint = long long; void solve() { lint x, y, z; std::cin >> x >> y >> z; lint rem = 0; if (x <= z) ++rem; if (x != y && y <= z) ++rem; std::cout << z - rem << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }