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