#include using namespace std; int main(void) { long long x, y, z; cin >> x >> y >> z; long long ans = z; if (z >= x) --ans; if (z >= y) --ans; cout << ans << endl; return 0; }