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