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