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