#include using namespace std; int main(int argc, char *argv[]) { int64_t L, R, M; cin >> L >> R >> M; int64_t sub = R - L + 1; if (sub >= M) { cout << M << endl; } else { cout << sub << endl; } return 0; }