#include using namespace std; int main(){ long long L,R,M; cin >> L >> R >> M; if(R-L+1>M)cout << M << endl; else cout << R-L+1 << endl; return 0; }