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