#include using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int L,R,M; while(cin >> L >> R >> M){ if(R-L+1 <= M) cout << R-L+1 << endl; else cout << M << endl; } return 0; }