#include using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); ll x, y, z; cin >> x >> y >> z; cout << z - (z >= x) - (z >= y) << endl; return 0; }