#include using namespace std; int main(){ int L, R, M; cin >> L >> R >> M; cout << min(R - L + 1, M) << endl; }