#include #include using namespace std; int main() { int l, r, m; cin >> l >> r >> m; cout << min(r-l+1, m); }