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