#include using namespace std; const vector dx_2d = {1,-1,0,0}; const vector dy_2d = {0,0,1,-1}; void Yyy(){ cout << "Yes" << endl; } void Nnn(){ cout << "No" << endl; } void fixprecision(){ cout << fixed << setprecision(20); } template bool chmin(T& a,T b){ if(a > b){ a = b; return true; } else return false; } template bool chmax(T& a,T b){ if(a < b){ a = b; return true; } else return false; } int main(){ long long int X,Y,Z; cin >> X >> Y >> Z; if(Z >= X && Z >= Y) Z -= 2; else if(Z >= X) Z--; else if(Z >= Y) Z--; cout << Z << endl; }