#include using namespace std; typedef long long ll; int main() { ll X, Y, Z; cin >> X >> Y >> Z; if (Y <= Z) Z--; if (X <= Z) Z--; cout << max(0ll, Z) << "\n"; return 0; }