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