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