#include #define int long long using namespace std; const int MOD = 1000000007; using Graph = vector>; signed main() { int L, R, M; cin >> L >> R >> M; if( R-L >= M ) cout << M << endl; else cout << R-L+1 << endl; }