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