#include #define rep(i, n) for (int i = 0; i < n; ++i) using ll = long long; using namespace std; const int INF = 1e9; int main() { ll X, Y, Z; cin >> X >> Y >> Z; cout << Z - (Z >= X) - (Z >= Y) << endl; return 0; }