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