#include using ll = long long; using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll l,r,m; cin >> l >> r >> m; if (r - l < m) cout << r - l + 1 << "\n"; else cout << m << "\n"; return 0; }